CTime转成CString出现DEBUG ASSERTION failed
- C/C++ code
///我用的是VS2008 CTime t = CTime::GetCurrentTime(); CString strTime = _T("(%y-%m-%d %H:%M:%str)"); strTime = t.Format(strTime); //这里出错了。不知道为什么?
[解决办法]
CTime t = CTime::GetCurrentTime();
CString strTime = _T("%y-%m-%d %H:%M:%S"); //多了括号
strTime = t.Format(strTime);
[解决办法]
改
:%str
为
:%S
就可以了
CTime的Format中,没有%str格式的
与()无关,只是结果会多对()