GetTimeZoneInformationForYear function (timezoneapi.h)

Retrieves the time zone settings for the specified year and time zone. These settings control the translations between Coordinated Universal Time (UTC) and local time.


BOOL GetTimeZoneInformationForYear(
  [in]           USHORT                         wYear,
  [in, optional] PDYNAMIC_TIME_ZONE_INFORMATION pdtzi,
  [out]          LPTIME_ZONE_INFORMATION        ptzi


[in] wYear

The year for which the time zone settings are to be retrieved. The wYear parameter must be a local time value.

[in, optional] pdtzi

A pointer to a DYNAMIC_TIME_ZONE_INFORMATION structure that specifies the time zone. To populate this parameter, call EnumDynamicTimeZoneInformation with the index of the time zone you want. If this parameter is NULL, the current time zone is used.

[out] ptzi

A pointer to a TIME_ZONE_INFORMATION structure that receives the time zone settings.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


The wYear parameter is assumed to be a local time value. If the local time is close to the transition between the old year and the new year (00:00:00 January 1), passing a UTC year to the GetTimeZoneInformationForYear function can cause the function to return time zone settings for the wrong year.

The StandardName and DaylightName members of the resultant TIME_ZONE_INFORMATION structure are localized according to the current user default UI language.


Requirement Value
Minimum supported client Windows Vista with SP1 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header timezoneapi.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also


Local Time


Time Functions