MFC怎么将字符串日期“2012-12-15”之类的转换成时间戳呢?
MFC怎么将字符串日期“2012-12-15”之类的转换成时间戳呢?
[解决办法]
boost中有函数可用。
- C/C++ code
#include "stdafx.h"#include "boost/date_time/posix_time/posix_time.hpp"using namespace boost::posix_time;int _tmain(int argc, _TCHAR* argv[]){ std::string ts("2002-01-20 23:59:59.000"); ptime t(time_from_string(ts)); tm pt_tm = to_tm( t );