how to add seconds to CTime in VC++?
Ex :
1 2 3 4
|
int i=0;
i=250;
CTime tm;
tm=tm+i;
|
??????
Last edited on
IIRC: tm = tm.GetTime() + 1 ;
Hi, i find out the solution
TimeEdBox=14:22:45 and TimeInterval=5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
CString CFileDialogDlg::TimeValueX(CString TimeEdBox,long TimeInterval)
{
CString Sec;
long sec, hr, min, t;
sec=TimeInterval;
hr = sec/3600;
t = sec%3600;
min = t/60;
sec = t%60;
Sec.Format("%d:%d:%d",hr,min,sec);
COleDateTime GetDate,AddDate;
GetDate.ParseDateTime(TimeEdBox);
AddDate.ParseDateTime(Sec);
GetDate=GetDate+AddDate;
CString ResultDate = GetDate.Format("%H:%M:%S");
return ResultDate;
}
|
Thanks to all
Last edited on