从time_t(秒数) 到字符形式和从字符形式到time_t
linux 下:
秒数到字符
time(&t)->
struct tm * tm=localtime(&t) -->strftime
字符到秒数
strptime-> struct tm -> mktime(tm)
windows vc
秒数到字符
CTime format
字符到秒数
CString s("2001-8-29 19:06:23");
int nYear, nMonth, nDate, nHour, nMin, nSec;
sscanf(s, "%d-%d-%d %d:%d:%d", &nYear, &nMonth, &nDate, &nHour,
&nMin, &nSec);
CTime t(nYear, nMonth, nDate, nHour, nMin, nSec);
阅读(2731) | 评论(0) | 转发(0) |