CTime之间求差值

CTimeSpan(
   LONG lDays,
   int nHours,
   int nMins,
   int nSecs 
);

//////求差值====================================

Ctime T1=CTime::GetCurrentTime();

CTime T2(2018,8,10,0,0,0);

CTimeSpan timespan=T1-T2;

int nSeconds=time.GetTotalSeconds();//获取时间差的总秒数

int nDays=time.GetDays();//获取时间差中的天

int nHours=time.GetHours();//获取时间差中的时

int nMinutes=time.GetMinutes();//获取时间差中的分钟

int nSec=time.GetSeconds();//获取时间差中的秒钟

////时间增加一天=========================================

CTime m_time=CTime::GetCurrentTime() + CTimeSpan(1,0,0,0);

//时间增加一个小时

CTime m_time=CTime::GetCurrentTime()+CTimeSpan(0,1,0,0);

//分钟和秒数方法相同。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章