16,548
社区成员




#include <afx.h> //需要这个头文件
.................
CTime t( 1999, 3, 19, 22, 15, 0 ); // 10:15PM March 19, 1999
time_t osBinaryTime = t.GetTime(); // time_t defined in <time.h>
printf( "time_t = %ld\n", osBinaryTime );
CTime tm //或者用COleDateTime, CTime只能表示1970:1:1之后的日期
tm = CTime::GetCurrentTime();
CString str = tm.Format("%Y-%m-%d %H:%M:%S");
SetDlgItemText(IDC_EDIT1, str);