I am reading a datetime from database in a ColeDateTime
format. I want to convert it to CTime
to get the date month year and time.
CString repDt; //**this will hold the datetime which i read from Database**
COleDateTime dt;
//**my datetime format is mm/dd/yyyy.**
dt.ParseDateTime(repDt); **//this line of code gives exception**
CTime t(dt.GetYear(), dt.GetMonth(), dt.GetDay(), dt.GetHour(),
dt.GetMinute(), dt.GetSecond());
m_time=t.GetTime();
Please give me some solution how could I do this?
Thanks in advance.
The
CTime
constructor accepts bothSYSTEMTIME
andDBTIMESTAMP
structures, so both these will work:,