#include <iostream.h>//#include <winbase.h>#include <windows.h>//#pragma comment(lib,"kernel32.lib")//using namespace std;void main(){SYSTEMTIME systime;GetLocalTime(&systime);//本地時間cout<<"今天是:"; cout<<systime.wYear<<"年"<<systime.wMonth<<"月"<<systime.wDay<<"日"<<endl;cout<<"現在時間是:";cout<<systime.wHour<<":"<<systime.wMinute<<":"<<systime.wSecond<<":"<<systime.wMilliseconds<<endl;cout<<"星期"<<systime.wDayOfWeek<<endl;cout<<endl;GetSystemTime(&systime);//系統時間cout<<"現在時間是:";cout<<systime.wHour<<":"<<systime.wMinute<<":"<<systime.wSecond<<":"<<systime.wMilliseconds<<endl;cout<<endl;} GetSystemTime:所返回的是UTC. 國際標準時間(Coordinated Universal Time,簡寫作UTC,之前也被拼做Universal Time Coordinated,有時是Universal Coordinated Time)是由國際無線電諮詢委員會定義和建議採用的,並由國際時間局(BIH)負責保持的以國際單位制(SI)秒為單位的時間標度。對與無線電規則相關的大部分實際應用而言,國際標準時間(UTC)與本初子午線(經度零度)上的平均太陽時等效。該時間過去以格林威治平均時(GMT)表示。 國際標準時間使用24小時制的時鐘錶示,但也可以被轉換為12小時制的時鐘(AM和PM)。UTC用于飛行和航海,它有時也被稱作祖魯。UTC使用陽曆 -------------------------------- GetLocalTime:返回的是本地時間,我建議一般用這個時間來作為你使用的時間 void getsystemtime( lpsystemtime lpsystemtime // system time ); void getlocaltime( lpsystemtime lpsystemtime // system time ); typedef struct _systemtime { word wyear; word wmonth; word wdayofweek; word wday; word whour; word wminute; word wsecond; word wmilliseconds; } systemtime, *psystemtime;SYSTEMTIME systm; GetSystemTime(&systm);