Reputation: 33
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
Reputation: 1165
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