最好能给个小例子,本人初学,讲解一下,谢谢各位大侠!!
------解决方案--------------------
- C/C++ code
SYSTEMTIME sysTime;GetLocalTime(&sysTime);
------解决方案--------------------
1.使用CTime类
CString str;
//获取系统时间
CTime tm;
tm=CTime:: GetCurrentTime_r();
str=tm.Format("现在时间是%Y年%m月%d日 %X");
MessageBox(str,NULL,MB_OK);
2: 得到系统时间日期(使用GetLocalTime)
SYSTEMTIME st;
CString strDate,strTime;
GetLocalTime_r(&st);
strDate.Format("%4d-%2d-%2d",st.wYear,st.wMonth,st.wDay);
strTime.Format("%2d:%2d:%2d",st.wHour,st.wMinute,st.wSecond);