CTime是一個時間函數,回傳時間的年月日時分秒等有關時間數值,可以參考微軟官網CTime。
CTime t = CTime::GetCurrentTime();
CString csCurrentTime;
csCurrentTime = t.Format("%Y-%m-%d %H:%M:%S");
printf("Current time 1 : %s\n", csCurrentTime);
csCurrentTime.Format("%04d-%02d-%02d %02d:%02d:%02d", t.GetYear(), t.GetMonth(), t.GetDay(), t.GetHour(), t.GetMinute(), t.GetSecond());
printf("Current time 2 : %s\n", csCurrentTime);
執行結果

沒有留言:
張貼留言