Windows API Reference

SYSTEMTIME Structure

The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and milliseconds.

Syntax

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

Members

MemberTypeDescription
wYearWORDYear (e.g., 2025).
wMonthWORDMonth of the year (1-12).
wDayOfWeekWORDDay of the week (0=Sunday, 6=Saturday). Ignored when converting to/from FILETIME.
wDayWORDDay of the month (1-31).
wHourWORDHour in 24‑hour format (0-23).
wMinuteWORDMinute (0-59).
wSecondWORDSecond (0-59).
wMillisecondsWORDMilliseconds (0-999).

Example

Convert the current system date and time to a SYSTEMTIME structure and display it.

#include 
#include 

int main(void) {
    SYSTEMTIME st;
    GetLocalTime(&st);
    printf("Current time: %04d-%02d-%02d %02d:%02d:%02d.%03d\n",
           st.wYear, st.wMonth, st.wDay,
           st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
    return 0;
}

Related Functions