1.CTime对象转换为DWORD类型
CTime time=CTime::GetCurrentTime(); //获取当前时间 DWORD timedw = time.GetTime(); //CTime->DWORD
2.DWORD类型变量转换为CTime对象
CTime time1(timedw); //DWORD->CTime CString strTime;
strTime.Format( "%d-%d-%d %d:%d:%d", time1.GetYear(),time1.GetMonth(),time1.GetDay(),time1.GetHour(),time.GetMinute(),time.GetSecond()); //CTime的格...
CTime, 字符转换阅读全文
CString--->COleDateTime: 方法1:COleDateTime::ParseDateTime()
CString strDate = _T("1987-06-21"); COleDateTime oleDate; oleDate.ParseDateTime(strDate, VAR_DATEVALUEONLY); 方法2:COleVariant
CString strDate = _T("1987-06-21"); COleVariant varTime(strDate); varTime.ChangeType(VT_DATE); COleDateTime oleDate(varTime); //COleDateTime oleDate; //o...
COleDateTime, CString, CTime, 字符转换阅读全文
1. ************************************************
COleDateTime time; time.ParseDateTime("2008-02-29");
if (time.GetStatus() == 1) //有效
{}
else //无效
{}
2. ***********************************************
COleDateTime t; // this one is a leap year t.SetDateTime(2000, 2, 29, 5, 0, 0); ...
COleDateTime, CTime阅读全文