知道一个时间(年月日时分秒),想在这个时间上加上一个秒数,比如加3、5、16...秒,怎么得得到计算后的时间(年月日时分秒)??

解决方案 »

  1.   

    Example
    // example for CTimeSpan::operator +, -
    CTimeSpan ts1( 3, 1, 5, 12 ); // 3 days, 1 hour, 5 min, and 12 sec
    CTimeSpan ts2( 100 ); // 100 seconds
    CTimeSpan ts3 = ts1 + ts2;
    ATLASSERT( ts3.GetSeconds() == 52 ); // 6 mins, 52 secs
      

  2.   

    ctime(年,月,日,后面就是分秒,查下MSDN)
      

  3.   

    COleDateTime odtThisTime(2008,1,15,10,3,46);//基础时间:2008-01-15 10:03:46
    COleDateTimeSpan odtsOneSec(0,0,0,1);//时间间隔:1秒
    COleDateTime odtNextSecond = odtThisTime + odtsOneSec;在MSDN中搜索COleDateTime类和COleDateTimeSpan类,有例可循!
      

  4.   

    解决方法有很多,我一般是先转换成FILETIME,加上秒数,再转回SYSTEMTIME。