Surfing around this guy had a partial list... but I wanted a full one.
I then looked at some old opennetcf code which parsed the timezone info from the registry... only to discover that Vista has moved the timezone code away from the registry....
I then discovered the right way... the latest .NET System.Core library has a TimeZoneInfo class (struct?) and some useful helper methods
To dump out a list is as simple as:
ReadOnlyCollection < TimeZoneInfo > collection = TimeZoneInfo.GetSystemTimeZones();
foreach (var t in collection)
{
Debug.WriteLine(string.Format("{1} - {0}", t.DisplayName, t.Id));
}
However... there is a possible problem running this on ASP.Net on a shared host - it probably will hit the registry on older PCs... so I've cached the results instead....
class TimeZoneHelper
{
public string DisplayName { get; set; }
public string Id { get; set; }
}
static ListGetTimeZoneHelpers()
{
return new List()
{
new TimeZoneHelper() { DisplayName="(GMT) Casablanca", Id="Morocco Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London", Id="GMT Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT) Monrovia, Reykjavik", Id="Greenwich Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna", Id="W. Europe Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague", Id="Central Europe Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+01:00) Brussels, Copenhagen, Madrid, Paris", Id="Romance Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb", Id="Central European Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+01:00) West Central Africa", Id="W. Central Africa Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Amman", Id="Jordan Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Athens, Bucharest, Istanbul", Id="GTB Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Beirut", Id="Middle East Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Cairo", Id="Egypt Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Harare, Pretoria", Id="South Africa Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius", Id="FLE Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Jerusalem", Id="Israel Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Minsk", Id="E. Europe Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+02:00) Windhoek", Id="Namibia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+03:00) Baghdad", Id="Arabic Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+03:00) Kuwait, Riyadh", Id="Arab Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+03:00) Moscow, St. Petersburg, Volgograd", Id="Russian Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+03:00) Nairobi", Id="E. Africa Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+03:00) Tbilisi", Id="Georgian Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+03:30) Tehran", Id="Iran Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+04:00) Abu Dhabi, Muscat", Id="Arabian Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+04:00) Baku", Id="Azerbaijan Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+04:00) Yerevan", Id="Caucasus Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+04:30) Kabul", Id="Afghanistan Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+05:00) Ekaterinburg", Id="Ekaterinburg Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+05:00) Islamabad, Karachi", Id="Pakistan Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+05:00) Tashkent", Id="West Asia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi", Id="India Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+05:30) Sri Jayawardenepura", Id="Sri Lanka Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+05:45) Kathmandu", Id="Nepal Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+06:00) Almaty, Novosibirsk", Id="N. Central Asia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+06:00) Astana, Dhaka", Id="Central Asia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+06:30) Yangon (Rangoon)", Id="Myanmar Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+07:00) Bangkok, Hanoi, Jakarta", Id="SE Asia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+07:00) Krasnoyarsk", Id="North Asia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi", Id="China Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+08:00) Irkutsk, Ulaan Bataar", Id="North Asia East Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+08:00) Kuala Lumpur, Singapore", Id="Singapore Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+08:00) Perth", Id="W. Australia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+08:00) Taipei", Id="Taipei Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+09:00) Osaka, Sapporo, Tokyo", Id="Tokyo Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+09:00) Seoul", Id="Korea Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+09:00) Yakutsk", Id="Yakutsk Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+09:30) Adelaide", Id="Cen. Australia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+09:30) Darwin", Id="AUS Central Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+10:00) Brisbane", Id="E. Australia Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+10:00) Canberra, Melbourne, Sydney", Id="AUS Eastern Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+10:00) Guam, Port Moresby", Id="West Pacific Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+10:00) Hobart", Id="Tasmania Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+10:00) Vladivostok", Id="Vladivostok Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+11:00) Magadan, Solomon Is., New Caledonia", Id="Central Pacific Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+12:00) Auckland, Wellington", Id="New Zealand Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+12:00) Fiji, Kamchatka, Marshall Is.", Id="Fiji Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT+13:00) Nuku'alofa", Id="Tonga Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-01:00) Azores", Id="Azores Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-01:00) Cape Verde Is.", Id="Cape Verde Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-02:00) Mid-Atlantic", Id="Mid-Atlantic Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-03:00) Brasilia", Id="E. South America Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-03:00) Buenos Aires", Id="Argentina Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-03:00) Georgetown", Id="SA Eastern Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-03:00) Greenland", Id="Greenland Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-03:00) Montevideo", Id="Montevideo Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-03:30) Newfoundland", Id="Newfoundland Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-04:00) Atlantic Time (Canada)", Id="Atlantic Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-04:00) La Paz", Id="SA Western Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-04:00) Manaus", Id="Central Brazilian Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-04:00) Santiago", Id="Pacific SA Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-04:30) Caracas", Id="Venezuela Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-05:00) Bogota, Lima, Quito, Rio Branco", Id="SA Pacific Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-05:00) Eastern Time (US & Canada)", Id="Eastern Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-05:00) Indiana (East)", Id="US Eastern Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-06:00) Central America", Id="Central America Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-06:00) Central Time (US & Canada)", Id="Central Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-06:00) Guadalajara, Mexico City, Monterrey", Id="Central Standard Time (Mexico)", },
new TimeZoneHelper() { DisplayName="(GMT-06:00) Saskatchewan", Id="Canada Central Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-07:00) Arizona", Id="US Mountain Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-07:00) Chihuahua, La Paz, Mazatlan", Id="Mountain Standard Time (Mexico)", },
new TimeZoneHelper() { DisplayName="(GMT-07:00) Mountain Time (US & Canada)", Id="Mountain Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-08:00) Pacific Time (US & Canada)", Id="Pacific Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-08:00) Tijuana, Baja California", Id="Pacific Standard Time (Mexico)", },
new TimeZoneHelper() { DisplayName="(GMT-09:00) Alaska", Id="Alaskan Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-10:00) Hawaii", Id="Hawaiian Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-11:00) Midway Island, Samoa", Id="Samoa Standard Time", },
new TimeZoneHelper() { DisplayName="(GMT-12:00) International Date Line West", Id="Dateline Standard Time", }
};
No comments:
Post a Comment