EnumDynamicTimeZoneInformation function

Enumerates DYNAMIC_TIME_ZONE_INFORMATION entries stored in the registry. This information is used to support time zones that experience annual boundary changes due to daylight saving time adjustments. Use the information returned by this function when calling GetDynamicTimeZoneInformationEffectiveYears to retrieve the specific range of years to pass to GetTimeZoneInformationForYear.

Syntax

DWORD EnumDynamicTimeZoneInformation(
  const DWORD                    dwIndex,
  PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation
);

Parameters

dwIndex

Index value that represents the location of a DYNAMIC_TIME_ZONE_INFORMATION entry.

lpTimeZoneInformation

Specifies settings for a time zone and dynamic daylight saving time.

Return Value

This function returns DWORD. Possible return values include:

Value Description
ERROR_SUCCESS The operation succeeded.
ERROR_NO_MORE_ITEMS No more data is available for the given index.
ERROR_INVALID_PARAMETER A parameter is invalid.
Any other value The operation failed.

Remarks

The following example demonstrates looping through the potential timezones until ERROR_NO_MORE_ITEMS is returned, indicating that there are no more time zone entries in the registry.

std::vector<std::wstring> possibleTimezones;
DYNAMIC_TIME_ZONE_INFORMATION dynamicTimezone = {};
DWORD dwResult = 0;
DWORD i = 0;

do
{
    dwResult = EnumDynamicTimeZoneInformation(i++, &dynamicTimezone);
    if (dwResult == ERROR_SUCCESS)
    {
        possibleTimezones.push_back(dynamicTimezone);
    }
}
while (dwResult != ERROR_NO_MORE_ITEMS);

Requirements

   
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header timezoneapi.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See Also

DYNAMIC_TIME_ZONE_INFORMATION

GetDynamicTimeZoneInformationEffectiveYears