0.变量定义
string str;
CString c_str;
CTime c_time;
COLeDateTime ole_time;
CString c_str;
1.CString和string互相转换
1.1 CString转string
str = CT2A(c_str);
1.2.string转CString
c_str = CA2T(str.c_str());
2.CString、COleDateTime、CTime相互转换
2.1 CTime转COleDateTime
SYSTEMTIME sys_time;
c_time.GetAsSystemtime(sys_time);
ole_time = COLeDateTime(sys_time);
2.2 COLeDateTime转CTime
SYSTEMTIME sys_time;
ole_time.GetAsSystemtime(sys_time);
c_time = CTime(sys_time);
2.3 CString转COleDateTime
ole_time = ParseDateTime(c_str);
2.4 COleDateTime转CString
c_str = ole_time.Format("%Y-%m-%d");
2.5 CTime转CString
c_str = c_time.Format("%Y-%m-%d");