I would like to have a list of all the time zones available on a Windows Machine. How can I do this in .NET?
I know about the TimeZoneInfo.GetSystemTimeZones method, but this returns only the currently selected time zone(s)
DateTimeOffset current = DateTimeOffset.Now;
ReadOnlyCollection<TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones();
Console.WriteLine("You might be in the following time zones:");
foreach (TimeZoneInfo timeZoneInfo in timeZones)
{
// Compare offset with offset for that date in that time zone
if (timeZoneInfo.GetUtcOffset(current).Equals(current.Offset))
{
Console.WriteLine(" {0}", timeZoneInfo.DisplayName);
}
}