CTime time;
//以下输出为数字
time.GetYear()
time.GetMonth()
time.GetDay()
time.GetHour()
time.GetMinute()
time.GetSecond()
//以下可输出字符串
time.Format()
ctime()

解决方案 »

  1.   

    我来补充一点吧:
    CTime Time;
    Time.Format();//其中的参数如下:
    %a简短的周名%A完整的周名
    %b简短的月名
    %B完整的月名
    %c用适合本地的形式描述日期和时间%d以十进制(01 - 31)来描述天数(一个月中的)%HHour in 24-hour format (00 – 23)%IHour in 12-hour format (01 – 12)%jDay of year as decimal number (001 – 366)%mMonth as decimal number (01 – 12)%MMinute as decimal number (00 – 59)%p按照本地的方式来给以12-小时记时的钟标注A.M或P.M%SSecond as decimal number (00 – 59)%UWeek of year as decimal number, with Sunday as first day of week (00 – 53)%wWeekday as decimal number (0 – 6; Sunday is 0)%WWeek of year as decimal number, with Monday as first day of week (00 – 53)%x以本地方式描述日期%X以本地方式描述时间%yYear without century(没有世纪标注), as decimal number (00 – 99)%YYear with century(有世纪), as decimal number%z, %Z时间区域的名称或缩写;如果此时间区域是未知的那么就没有任何字符%%百分比符号
      

  2.   

    MSDN里面讲得很详细,而且还有示例。CTime,COleDateTime。
      

  3.   

    谢谢WINMAIN,LHXX,SFCYYC,小女子感激不尽。