1 获取时间格式 2013-03-04 07:08
CString strDate,strTime;
CTime tm = CTime::GetCurrentTime();
strDate = tm.Format(L"%Y-%m-%d");
strTime = tm.Format(L"%H:%m");
2 获取时间格式 2013-3-4 7:8
SYSTEMTIME st;
GetLocalTime(&st); //GetlocalTime 获取的是北京时间 GetSystemTime 是UTC时间
strDate.Format(L"%4-%2-%2d",st.wYear,st.wMonth,st.wDay);
strTime.Format(L"%2d:%2d",st.wHo

本文介绍了如何在MFC中获取和设置系统时间。通过CTime和SYSTEMTIME结构体,展示获取不同格式时间的方法,并展示了设置系统时间的步骤,包括从编辑框获取时间值,以及对时间进行加减操作的例子。
最低0.47元/天 解锁文章
1169

被折叠的 条评论
为什么被折叠?



