怎样把2014-12-19 10:25转换成1418955940的格式
http://biancheng.dnbcw.info/c/49205.html
time_t Str2Time(LPCTSTR lpszTime)
{
ASSERT(NULL != lpszTime);
struct tm time = {0};
_stscanf(lpszTime, _T("%4d-%2d-%2d %2d:%2d"),
&time.tm_year,
&time.tm_mon,
&time.tm_mday,
&time.tm_hour,
&time.tm_min);
time.tm_year -= 1900;
time.tm_mon -= 1;
time.tm_isdst = -1;
time_t Value = mktime(&time);
return Value;
}
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
cout<<Str2Time(_T("2014-12-19 10:25"))<<endl;
return 0;
}
转换成time_t格式,就是秒数