获取系统当前时间的步骤

获取系统当前时间的方法刚刚在写程序,想获取当前的系统时间保存在数据库中,一时忘了,查了下。SYSTEMTIMEtim

获取系统当前时间的方法

刚刚在写程序,想获取当前的系统时间保存在数据库中,一时忘了,查了下。

SYSTEMTIME   time; 

GetSystemTime(&time);//得到格林威治标准时间 
GetLocalTime(&time);   //得到当地的时间(我们为东八区的北京时间:P) 

补充:

SYSTEMTIME结构

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