如何将DWORD类型转换成时间类型?
能介绍其它类型转换成时间类型的函数吗??

解决方案 »

  1.   

    CTime        t(dwTime);
    COleDateTime tmBase (t.GetYear(),t.GetMonth(),t.GetDay(),t.GetHour(),t.GetMinute(),t.GetSecond());
    偶用COleDateTime用习惯了,所以就把它转换成COleDateTime吧
      

  2.   

    我的dword是1052982295
    (是读取日志中的信息pevlr->TimeWritten得到的,我想将其分离成正规的日期格式)
    年月日 和时间 
    如何作阿?
      

  3.   

    CTime类中记录时间的成员变量就是long 类型的,偶只好猜它是CTime格式啦,可以这样做:
    DWORD        dwTime = 1052982295;
    CTime        t(dwTime);然后可以用以下函数
    t.GetYear()
    t.GetMonth()
    t.GetDay()t.GetHour()
    t.GetMinute()
    t.GetSecond()
      

  4.   

    sorry
    DWORD        dwTime = 1052982295;
    是从1970年1月1日00:00:00  开始的秒数(This time is measured in the number of seconds elapsed since January 1, 1970, Universal Coordinated Time)我该如何转换成时间的年月日阿?
      

  5.   

    // 算法思想大致如下:long SecondsPerDay = 86400;
    long SecondsPerMonth = 86400 * 30;
    long SecondsPerYear = 86400 * 365;long SecondsPerHour = 3600
    long SecondsPerMinute = 60long Years, Months, Days, Hours, Minutes, Seconds, Remain;
     Years = dwTime /SecondsPerYear;
     Remain = dwTime % SecondsPerYear;
     Months = Remain /SecondsPerMonth;
     Remain = Remain % SecondsPerMonth;
     Days = Remain/ SecondsPerDay;
     Remain = Remain % SecondsPerDay;
     Hours = Remain / SecondsPerHour;
     Remain = Remain % SecondsPerHour;
     Minutes = Remain / SecondsPerMinute;
     Remain = Remain % SecondsPerMinute;
     Seconds = Remain; NowYear = 1970 + Years;
     NowMonth = Months;
     NowDay = Days;
     NowHour = Hours;
     NowMinute = Minutes;
     NowSecond = Seconds;