获得系统时间

#include <iostream>
#include <windows.h>
using namespace std;

int main()
{
    SYSTEMTIME stime;
    GetLocalTime( &stime );
    cout << stime.wYear;
    return 0;
}

SYSTEMTIME 其实是个结构体,其具体成员如下:
 

typedef struct _SYSTEMTIME { 
WORD wYear; 
WORD wMonth; 
WORD wDayOfWeek; 
WORD wDay;
 WORD wHour; 
WORD wMinute; 
WORD wSecond; 
WORD wMilliseconds;
 } SYSTEMTIME;

你可能感兴趣的:(系统时间)