windows API 获取日期

http://msdn.microsoft.com/en-us/library/windows/desktop/ms725473(v=vs.85).aspx

#include <windows.h>
#include <stdio.h>

void main()
{
    SYSTEMTIME st, lt;
   
    GetSystemTime(&st);
    GetLocalTime(&lt);
   
    printf(“The system time is: %02d:%02d\n”, st.wHour, st.wMinute);
    printf(” The local time is: %02d:%02d\n”, lt.wHour, lt.wMinute);
}

// Sample output

The system time is: 19:34
The local time is: 12:34

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用 * 标注