Daniel Venter
Daniel Venter

Reputation: 33

Is there a way to get the timezone information for all current timezones

I am currently working on a project where I want to collect all the timezone info for all current timezones.

The WinApi.Windows.GetTimeZoneInformation function only returns the current timezone data. Is there a way to get a list of all timezones?

I do not need it to be 100% accurate according to https://www.iana.org/time-zones and i do not need to store it in a database. I just need to get the data for the user to pick additional timezones for reminders.

Upvotes: 0

Views: 856

Answers (1)

Since you tagged this as winapi, you can query the following registry path:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones

The key binary blob TZI corresponds to a REG_TZI_FORMAT structure which, in Delphi, looks like this:

uses WinApi.Windows;

REG_TZI_FORMAT = record
    Bias:           LONG;
    StandardBias:   LONG;
    DaylightBias:   LONG;

    StandardDate:   SYSTEMTIME;
    DaylightDate:   SYSTEMTIME;
end;

Upvotes: 1

Related Questions