Warning: file_put_contents(/datas/wwwroot/jiajiahui/core/caches/caches_template/2/default/show.php): failed to open stream: Permission denied in /datas/wwwroot/jiajiahui/core/libraries/classes/template_cache.class.php on line 55

Warning: chmod(): Operation not permitted in /datas/wwwroot/jiajiahui/core/libraries/classes/template_cache.class.php on line 56
MFC日期与字符串相互转换 - 源码之家

MFC日期与字符串相互转换

COleDateTime a;  
CString b = _T("2012-12-24  15:30:48");  
bool    f = a.ParseDateTime(b,LOCALE_NOUSEROVERRIDE);//字符串转日期  
  
int c = a.GetHour();//取出时间  
  
//获取系统当前时间,并转成字符串  
COleDateTime dateTest;  
dateTest = COleDateTime::GetCurrentTime();  
CString F;   
F.Format(_T("%d"),dateTest.GetYear());//取出年  
  
//当前时间的字符串  
CString g = dateTest.Format(_T("%Y-%m-%d %H:%M:%S"));