The GetTimeZoneInformation function retrieves the current time-zone parameters. These parameters control the translations between Coordinated Universal Time (UTC) and local time.
DWORD GetTimeZoneInformation(
LPTIME_ZONE_INFORMATION lpTimeZoneInformation // address of
// time-zone settings
);
If the function succeeds, the return value is one of the following values:
Value | Meaning |
---|---|
TIME_ZONE_ID_UNKNOWN | The system cannot determine the current time zone. This error is also returned if you call the SetTimeZoneInformation function and supply the bias values but no transition dates. Windows NT: This value is returned if daylight savings time is not used in the current time zone, because there are no transition dates. |
TIME_ZONE_ID_STANDARD | The system is operating in the range covered by the StandardDate member of the TIME_ZONE_INFORMATION structure. Windows 95: This value is returned if daylight savings time is not used in the current time zone, because there are no transition dates. |
TIME_ZONE_ID_DAYLIGHT | The system is operating in the range covered by the DaylightDate member of the TIME_ZONE_INFORMATION structure. |
If the function fails, the return value is TIME_ZONE_ID_INVALID. To get extended error information, call GetLastError.
All translations between UTC time and local time are based on the following formula:
UTC = local time + bias
The bias is the difference, in minutes, between UTC time and local time.
Windows CE: The GetTimeZoneInformation function always returns TIME_ZONE_ID_UNKNOWN.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Time Overview, Time Functions, SetTimeZoneInformation, TIME_ZONE_INFORMATION