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);

//分鐘和秒數方法相同。

 

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