MFC CString 转换为SYSTEMTIME格式
答案:1 悬赏:30 手机版
解决时间 2021-04-01 16:52
- 提问者网友:疯子也有疯子的情调
- 2021-04-01 10:21
MFC CString 转换为SYSTEMTIME格式
最佳答案
- 五星知识达人网友:从此江山别
- 2021-04-01 11:30
int nYear = 0;
int nMonth = 0;
int nDay = 0;
int nHour = 0;
int nSecond = 0;
int nMinute = 0;
CString str ;
SYSTEMTIME time;
_stscanf(str, _T("%d-%d-%d %d:%d:%d"), &nYear, &nMonth, &nDay, &nHour, &nMinute, &nSecond);
if (nMonth==0 || nDay==0)
{
_stscanf(str, _T("%d/%d/%d %d:%d:%d"), &nYear, &nMonth, &nDay, &nHour, &nMinute, &nSecond);
}
time.wYear = nYear;
time.wMonth = nMonth;
time.wDay = nDay;
time.wHour = nHour;
time.wSecond = nSecond;
time.wMinute = nMinute;
int nMonth = 0;
int nDay = 0;
int nHour = 0;
int nSecond = 0;
int nMinute = 0;
CString str ;
SYSTEMTIME time;
_stscanf(str, _T("%d-%d-%d %d:%d:%d"), &nYear, &nMonth, &nDay, &nHour, &nMinute, &nSecond);
if (nMonth==0 || nDay==0)
{
_stscanf(str, _T("%d/%d/%d %d:%d:%d"), &nYear, &nMonth, &nDay, &nHour, &nMinute, &nSecond);
}
time.wYear = nYear;
time.wMonth = nMonth;
time.wDay = nDay;
time.wHour = nHour;
time.wSecond = nSecond;
time.wMinute = nMinute;
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯