CString和CTime互相转换

//CString转CTime==============

CString strT1="2020-02-02 02:02:02";

int ny,nm.nd;

sscanf(strT1.GetBuffer(strT1.GetLength()),"%d-%d-%d",&ny,&nm,&nd);

CTime T1(a,b,c,0,0,0);

//CTime转CString

CTime T1=CTime::GetCurrentTime();

CString strT1;

strT1.Format("%d-%d-%d",T1.GetYear,T1.GetMonth(),T1.GetDay());

猜你喜欢

转载自blog.csdn.net/Hat_man_/article/details/106342167