CTimeSpan delta(0, 0, 2600, 0); //设置2600分钟的时间间隔
CTime now = CTime::GetCurrentTime(); //获取当前时间
now += delta; //加上2600分钟的时间间隔
CString strTime; //转换为CString, 注意CTime::Format在有些时候不支持中文,顾这种方法比较保险
strTime.Format(_T("%d年%d月%d日%d时%d分"),
now.GetYear(),
now.GetMonth(),
now.GetDay(),
now.GetHour(),
now.GetMinute()
);
CTimeSpan类成员
CTimeSpan::CTimeSpan
CTimeSpan( );
CTimeSpan( const CTimeSpan& timeSpanSrc );
CTimeSpan( time_t time );
CTimeSpan( LONG lDays, int nHours, int nMins, int nSecs );
参数: timeSpanSrc 一个已存在的CTimeSpan对象。
time 一个time_t时间值。
lDays, nHours, nMins, nSecs 分别代表日,时,分,秒
注意:本文归作者所有,未经作者允许,不得转载