获得系统时间

1、使用CTime精确到秒

CTime time = CTime::GetCurrentTime();

CString time_str;

time_str.Format(_T("%d-%d-%d-%d"),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute());//

2、使用GetLocalTime精确到毫秒

SYSTEMTIME lpSystemTime;//精确到毫秒
GetLocalTime(&lpSystemTime);
CString time_str;
time_str.Format(_T("%02d-%02d-%03d:"),lpSystemTime.wMinute,lpSystemTime.wSecond,lpSystemTime.wMilliseconds);

posted @ 2017-01-17 13:53  朱小勇  阅读(146)  评论(0编辑  收藏  举报