VC将日期转字符串,将字符串装日期

来源:互联网 发布:数据库事务使用场景 编辑:程序博客网 时间:2024/04/28 01:38

 

//将日期转字符串

CString strTime;

strTime=CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S"));

 

 //字符串转时间,获取文本框时间   
  COleDateTime oleDate;
  SYSTEMTIME sys_time;
  CTime setTime;
  oleDate.ParseDateTime(strTime);
  oleDate.GetAsSystemTime(sys_time);
  setTime=CTime(sys_time);
 

0 0