Specifies a date and time, using individual members for the month, day, year, weekday, hour, minute, second, and millisecond. The time is either in coordinated universal time (UTC) or local time, depending on the function that is being called.
Syntaxtypedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
Members
wYear
The year. The valid values for this member are 1601 through 30827.
wMonth
The month. This member can be one of the following values.
Value MeaningwDayOfWeek
The day of the week. This member can be one of the following values.
Value MeaningwDay
The day of the month. The valid values for this member are 1 through 31.
wHour
The hour. The valid values for this member are 0 through 23.
wMinute
The minute. The valid values for this member are 0 through 59.
wSecond
The second. The valid values for this member are 0 through 59.
wMilliseconds
The millisecond. The valid values for this member are 0 through 999.
Note
The SYSTEMTIME does not check to see if the date represented is a real and valid date. When working with this API, you should ensure its validity, especially in leap year scenarios. See leap day readiness for more information.
It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should
The system can periodically refresh the time by synchronizing with a time source. Because the system time can be adjusted either forward or backward, do not compare system time readings to determine elapsed time. Instead, use one of the methods described in
Windows Time.
ExamplesThe following example demonstrates the difference between the time values retrieved by the GetSystemTime and GetLocalTime functions.
#include <windows.h>
#include <stdio.h>
void main()
{
SYSTEMTIME st, lt;
GetSystemTime(&st);
GetLocalTime(<);
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
Requirements Requirement Value Minimum supported client Windows 2000 Professional [desktop apps | UWP apps] Minimum supported server Windows 2000 Server [desktop apps | UWP apps] Header minwinbase.h (include Windows.h) See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3