MFC获取当前系统时间类

COleDateTime time;
time = COleDateTime::GetCurrentTime();
CString sTime = time.Format("%Y-%m-%d %H-%M-%S");

得到当前年月日,时分秒。

GetYear 返回当前系统年份。
GetMonth 返回当前系统的月份。(1-12)
GetDay 返回当前系统的日份。(1-31)
GetHour 返回当前系统的时钟。(0-23)
GetMinute 返回当前系统的分钟。(0-59)
GetSecond 返回当前系统的秒钟。(0-59)

猜你喜欢

转载自blog.csdn.net/qq_42712816/article/details/86518111