#include <iostream> #include <windows.h> using namespace std; int main() { SYSTEMTIME stime; GetLocalTime( &stime ); cout << stime.wYear; return 0; }
SYSTEMTIME 實際上是個結構體,其具體成員以下:
ios
typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds; } SYSTEMTIME;