在vc中,定义一个时间类Timer,能提供由时,分,秒组成的时间

来源:百度知道 编辑:UC知道 时间:2024/05/01 14:14:11

CTime time=CTime::GetCurrentTime();
CString strYY=time.Format("%Y");
CString strmm=time.Format("%m");
CString strdd=time.Format("%d");
CString strHH=time.Format("%H");
CString strMM=time.Format("%M");
CString strSS=time.Format("%S");
//当前时间
CString strTime;
strTime.Fromat("%s/%s/%s %s:%s:%s". strYY. strmm. strdd. strHH. strMM. strSS);


char bufTime[128] = {0};
char bufDate[128] = {0};
_strtime(bufTime);
_strdate(bufDate);
也可以啊

// example for CTime::GetCurrentTime
CTime t = CTime::GetCurrentTime();