List of Timezone IDs for use with FindTimeZoneById() in C#?
Asked Answered
J

14

351

Can someone please point me to a complete list of all the timezones referenced by the id expected in TimeZoneInfo.FindTimeZoneById()? I can't find a list anywhere and I've looked through the .NET documentation.

Josefjosefa answered 26/10, 2011 at 20:15 Comment(4)
If you notice in the answers below there are several confusingly duplicative time zone ids, you should read here to learn more: https://mcmap.net/q/21112/-quot-us-eastern-standard-time-quot-vs-quot-eastern-standard-time-quot-in-netJacksmelt
IMPORTANT - This data is not static. New time zones are introduced into Windows as the governments of the world make changes. This is ultimately why there are not authoritative pages listing them in the docs. Do not rely on any hardcoded list, but call TimeZoneInfo.FindTimeZoneById() yourself, or use TZUTIL.EXE /L to list them. The answers below are only but a snapshot of the data at the time they were reported. DO NOT COPY FROM HERE TO HARDCODE INTO YOUR APPLICATION!Alic
If needed, you can read from the registry at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones, or use the EnumDynamicTimeZoneInformation Windows API.Alic
Also, keep in mind that the list of timezones you receive will be drastically different on Unix systems. If you're accepting a time zone ID from a Windows system and trying to find it on a Unix system, it will fail even if both applications are written in C#.Impeller
L
459

Here's a full listing of a program and its results.

The code:

using System;

namespace TimeZoneIds
{
    class Program
    {
        static void Main(string[] args)
        {
            foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
            {
                Console.WriteLine(z.Id);
            }
        }
    }
}

The TimeZoneId results on my Windows 7 workstation:

Dateline Standard Time

UTC-11

Samoa Standard Time

Hawaiian Standard Time

Alaskan Standard Time

Pacific Standard Time (Mexico)

Pacific Standard Time

US Mountain Standard Time

Mountain Standard Time (Mexico)

Mountain Standard Time

Central America Standard Time

Central Standard Time

Central Standard Time (Mexico)

Canada Central Standard Time

SA Pacific Standard Time

Eastern Standard Time

US Eastern Standard Time

Venezuela Standard Time

Paraguay Standard Time

Atlantic Standard Time

Central Brazilian Standard Time

SA Western Standard Time

Pacific SA Standard Time

Newfoundland Standard Time

E. South America Standard Time

Argentina Standard Time

SA Eastern Standard Time

Greenland Standard Time

Montevideo Standard Time

UTC-02

Mid-Atlantic Standard Time

Azores Standard Time

Cape Verde Standard Time

Morocco Standard Time

UTC

GMT Standard Time

Greenwich Standard Time

W. Europe Standard Time

Central Europe Standard Time

Romance Standard Time

Central European Standard Time

W. Central Africa Standard Time

Namibia Standard Time

Jordan Standard Time

GTB Standard Time

Middle East Standard Time

Egypt Standard Time

Syria Standard Time

South Africa Standard Time

FLE Standard Time

Israel Standard Time

E. Europe Standard Time

Arabic Standard Time

Arab Standard Time

Russian Standard Time

E. Africa Standard Time

Iran Standard Time

Arabian Standard Time

Azerbaijan Standard Time

Mauritius Standard Time

Georgian Standard Time

Caucasus Standard Time

Afghanistan Standard Time

Ekaterinburg Standard Time

Pakistan Standard Time

West Asia Standard Time

India Standard Time

Sri Lanka Standard Time

Nepal Standard Time

Central Asia Standard Time

Bangladesh Standard Time

N. Central Asia Standard Time

Myanmar Standard Time

SE Asia Standard Time

North Asia Standard Time

China Standard Time

North Asia East Standard Time

Singapore Standard Time

W. Australia Standard Time

Taipei Standard Time

Ulaanbaatar Standard Time

Tokyo Standard Time

Korea Standard Time

Yakutsk Standard Time

Cen. Australia Standard Time

AUS Central Standard Time

E. Australia Standard Time

AUS Eastern Standard Time

West Pacific Standard Time

Tasmania Standard Time

Vladivostok Standard Time

Central Pacific Standard Time

New Zealand Standard Time

UTC+12

Fiji Standard Time

Kamchatka Standard Time

Tonga Standard Time

Lupitalupo answered 26/10, 2011 at 20:26 Comment(7)
Is the output of this list sensitive to whether you are currently in daylight savings or not? Otherwise, the names seem inaccurate. Eastern Standard Time is GMT - 5 but GMT - 4 most of the year.Tigrinya
Yes, the TimeZoneInfo.FindSystemTimeZoneById method is sensitive to daylight savings time... See msdn.microsoft.com/en-US/library/…. It states: "This TimeZoneInfo object is then used to convert the local time to the time in Tokyo and to determine whether it is Tokyo Standard Time or Tokyo Daylight Time."Kahler
@Tigrinya - You are correct. The ID names are misleading. "Eastern Standard Time" represents both EST and EDT.Alic
@Sebastian- just to avoid confusion, I think your first sentence should read, "No, the output of the program is NOT sensitive to daylight savings time." Regardless of what time of the year you run the program, the list will be the same, which is what JohnOpincar was asking.Saxon
Beware: Timezone names are sensitive to the operating system. Windows Server 2008 and Windows Server 2012 have different lists.Soak
And for a mapping from Windows to Linux, see #4968403Pedro
TimeZoneInfo.GetSystemTimeZones() on Azure App Service only returns 14 timezonesAircraftman
S
117

And if you'd like a HTML select with the Windows time zones in:

<select>
<option value="Morocco Standard Time">(GMT) Casablanca</option>
<option value="GMT Standard Time">(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London</option>
<option value="Greenwich Standard Time">(GMT) Monrovia, Reykjavik</option>
<option value="W. Europe Standard Time">(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna</option>
<option value="Central Europe Standard Time">(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague</option>
<option value="Romance Standard Time">(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</option>
<option value="Central European Standard Time">(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb</option>
<option value="W. Central Africa Standard Time">(GMT+01:00) West Central Africa</option>
<option value="Jordan Standard Time">(GMT+02:00) Amman</option>
<option value="GTB Standard Time">(GMT+02:00) Athens, Bucharest, Istanbul</option>
<option value="Middle East Standard Time">(GMT+02:00) Beirut</option>
<option value="Egypt Standard Time">(GMT+02:00) Cairo</option>
<option value="South Africa Standard Time">(GMT+02:00) Harare, Pretoria</option>
<option value="FLE Standard Time">(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius</option>
<option value="Israel Standard Time">(GMT+02:00) Jerusalem</option>
<option value="E. Europe Standard Time">(GMT+02:00) Minsk</option>
<option value="Namibia Standard Time">(GMT+02:00) Windhoek</option>
<option value="Arabic Standard Time">(GMT+03:00) Baghdad</option>
<option value="Arab Standard Time">(GMT+03:00) Kuwait, Riyadh</option>
<option value="Russian Standard Time">(GMT+03:00) Moscow, St. Petersburg, Volgograd</option>
<option value="E. Africa Standard Time">(GMT+03:00) Nairobi</option>
<option value="Georgian Standard Time">(GMT+03:00) Tbilisi</option>
<option value="Iran Standard Time">(GMT+03:30) Tehran</option>
<option value="Arabian Standard Time">(GMT+04:00) Abu Dhabi, Muscat</option>
<option value="Azerbaijan Standard Time">(GMT+04:00) Baku</option>
<option value="Mauritius Standard Time">(GMT+04:00) Port Louis</option>
<option value="Caucasus Standard Time">(GMT+04:00) Yerevan</option>
<option value="Afghanistan Standard Time">(GMT+04:30) Kabul</option>
<option value="Ekaterinburg Standard Time">(GMT+05:00) Ekaterinburg</option>
<option value="Pakistan Standard Time">(GMT+05:00) Islamabad, Karachi</option>
<option value="West Asia Standard Time">(GMT+05:00) Tashkent</option>
<option value="India Standard Time">(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi</option>
<option value="Sri Lanka Standard Time">(GMT+05:30) Sri Jayawardenepura</option>
<option value="Nepal Standard Time">(GMT+05:45) Kathmandu</option>
<option value="N. Central Asia Standard Time">(GMT+06:00) Almaty, Novosibirsk</option>
<option value="Central Asia Standard Time">(GMT+06:00) Astana, Dhaka</option>
<option value="Myanmar Standard Time">(GMT+06:30) Yangon (Rangoon)</option>
<option value="SE Asia Standard Time">(GMT+07:00) Bangkok, Hanoi, Jakarta</option>
<option value="North Asia Standard Time">(GMT+07:00) Krasnoyarsk</option>
<option value="China Standard Time">(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi</option>
<option value="North Asia East Standard Time">(GMT+08:00) Irkutsk, Ulaan Bataar</option>
<option value="Singapore Standard Time">(GMT+08:00) Kuala Lumpur, Singapore</option>
<option value="W. Australia Standard Time">(GMT+08:00) Perth</option>
<option value="Taipei Standard Time">(GMT+08:00) Taipei</option>
<option value="Tokyo Standard Time">(GMT+09:00) Osaka, Sapporo, Tokyo</option>
<option value="Korea Standard Time">(GMT+09:00) Seoul</option>
<option value="Yakutsk Standard Time">(GMT+09:00) Yakutsk</option>
<option value="Cen. Australia Standard Time">(GMT+09:30) Adelaide</option>
<option value="AUS Central Standard Time">(GMT+09:30) Darwin</option>
<option value="E. Australia Standard Time">(GMT+10:00) Brisbane</option>
<option value="AUS Eastern Standard Time">(GMT+10:00) Canberra, Melbourne, Sydney</option>
<option value="West Pacific Standard Time">(GMT+10:00) Guam, Port Moresby</option>
<option value="Tasmania Standard Time">(GMT+10:00) Hobart</option>
<option value="Vladivostok Standard Time">(GMT+10:00) Vladivostok</option>
<option value="Central Pacific Standard Time">(GMT+11:00) Magadan, Solomon Is., New Caledonia</option>
<option value="New Zealand Standard Time">(GMT+12:00) Auckland, Wellington</option>
<option value="Fiji Standard Time">(GMT+12:00) Fiji, Kamchatka, Marshall Is.</option>
<option value="Tonga Standard Time">(GMT+13:00) Nuku'alofa</option>
<option value="Azores Standard Time">(GMT-01:00) Azores</option>
<option value="Cape Verde Standard Time">(GMT-01:00) Cape Verde Is.</option>
<option value="Mid-Atlantic Standard Time">(GMT-02:00) Mid-Atlantic</option>
<option value="E. South America Standard Time">(GMT-03:00) Brasilia</option>
<option value="Argentina Standard Time">(GMT-03:00) Buenos Aires</option>
<option value="SA Eastern Standard Time">(GMT-03:00) Georgetown</option>
<option value="Greenland Standard Time">(GMT-03:00) Greenland</option>
<option value="Montevideo Standard Time">(GMT-03:00) Montevideo</option>
<option value="Newfoundland Standard Time">(GMT-03:30) Newfoundland</option>
<option value="Atlantic Standard Time">(GMT-04:00) Atlantic Time (Canada)</option>
<option value="SA Western Standard Time">(GMT-04:00) La Paz</option>
<option value="Central Brazilian Standard Time">(GMT-04:00) Manaus</option>
<option value="Pacific SA Standard Time">(GMT-04:00) Santiago</option>
<option value="Venezuela Standard Time">(GMT-04:30) Caracas</option>
<option value="SA Pacific Standard Time">(GMT-05:00) Bogota, Lima, Quito, Rio Branco</option>
<option value="Eastern Standard Time">(GMT-05:00) Eastern Time (US & Canada)</option>
<option value="US Eastern Standard Time">(GMT-05:00) Indiana (East)</option>
<option value="Central America Standard Time">(GMT-06:00) Central America</option>
<option value="Central Standard Time">(GMT-06:00) Central Time (US & Canada)</option>
<option value="Central Standard Time (Mexico)">(GMT-06:00) Guadalajara, Mexico City, Monterrey</option>
<option value="Canada Central Standard Time">(GMT-06:00) Saskatchewan</option>
<option value="US Mountain Standard Time">(GMT-07:00) Arizona</option>
<option value="Mountain Standard Time (Mexico)">(GMT-07:00) Chihuahua, La Paz, Mazatlan</option>
<option value="Mountain Standard Time">(GMT-07:00) Mountain Time (US & Canada)</option>
<option value="Pacific Standard Time">(GMT-08:00) Pacific Time (US & Canada)</option>
<option value="Pacific Standard Time (Mexico)">(GMT-08:00) Tijuana, Baja California</option>
<option value="Alaskan Standard Time">(GMT-09:00) Alaska</option>
<option value="Hawaiian Standard Time">(GMT-10:00) Hawaii</option>
<option value="Samoa Standard Time">(GMT-11:00) Midway Island, Samoa</option>
<option value="Dateline Standard Time">(GMT-12:00) International Date Line West</option>
</select>

And if you'd like to use it in C#.NET MVC in a Razor view:

var timezones = new List<SelectListItem> { 
new SelectListItem() { Value="", Text="Select timezone...", Selected = false },
new SelectListItem() { Value="Morocco Standard Time", Text="(GMT) Casablanca", Selected = false },
new SelectListItem() { Value="GMT Standard Time", Text="(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London", Selected = false },
new SelectListItem() { Value="Greenwich Standard Time", Text="(GMT) Monrovia, Reykjavik", Selected = false },
new SelectListItem() { Value="W. Europe Standard Time", Text="(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna", Selected = false },
new SelectListItem() { Value="Central Europe Standard Time", Text="(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague", Selected = false },
new SelectListItem() { Value="Romance Standard Time", Text="(GMT+01:00) Brussels, Copenhagen, Madrid, Paris", Selected = false },
new SelectListItem() { Value="Central European Standard Time", Text="(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb", Selected = false },
new SelectListItem() { Value="W. Central Africa Standard Time", Text="(GMT+01:00) West Central Africa", Selected = false },
new SelectListItem() { Value="Jordan Standard Time", Text="(GMT+02:00) Amman", Selected = false },
new SelectListItem() { Value="GTB Standard Time", Text="(GMT+02:00) Athens, Bucharest, Istanbul", Selected = false },
new SelectListItem() { Value="Middle East Standard Time", Text="(GMT+02:00) Beirut", Selected = false },
new SelectListItem() { Value="Egypt Standard Time", Text="(GMT+02:00) Cairo", Selected = false },
new SelectListItem() { Value="South Africa Standard Time", Text="(GMT+02:00) Harare, Pretoria", Selected = false },
new SelectListItem() { Value="FLE Standard Time", Text="(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius", Selected = false },
new SelectListItem() { Value="Israel Standard Time", Text="(GMT+02:00) Jerusalem", Selected = false },
new SelectListItem() { Value="E. Europe Standard Time", Text="(GMT+02:00) Minsk", Selected = false },
new SelectListItem() { Value="Namibia Standard Time", Text="(GMT+02:00) Windhoek", Selected = false },
new SelectListItem() { Value="Arabic Standard Time", Text="(GMT+03:00) Baghdad", Selected = false },
new SelectListItem() { Value="Arab Standard Time", Text="(GMT+03:00) Kuwait, Riyadh", Selected = false },
new SelectListItem() { Value="Russian Standard Time", Text="(GMT+03:00) Moscow, St. Petersburg, Volgograd", Selected = false },
new SelectListItem() { Value="E. Africa Standard Time", Text="(GMT+03:00) Nairobi", Selected = false },
new SelectListItem() { Value="Georgian Standard Time", Text="(GMT+03:00) Tbilisi", Selected = false },
new SelectListItem() { Value="Iran Standard Time", Text="(GMT+03:30) Tehran", Selected = false },
new SelectListItem() { Value="Arabian Standard Time", Text="(GMT+04:00) Abu Dhabi, Muscat", Selected = false },
new SelectListItem() { Value="Azerbaijan Standard Time", Text="(GMT+04:00) Baku", Selected = false },
new SelectListItem() { Value="Mauritius Standard Time", Text="(GMT+04:00) Port Louis", Selected = false },
new SelectListItem() { Value="Caucasus Standard Time", Text="(GMT+04:00) Yerevan", Selected = false },
new SelectListItem() { Value="Afghanistan Standard Time", Text="(GMT+04:30) Kabul", Selected = false },
new SelectListItem() { Value="Ekaterinburg Standard Time", Text="(GMT+05:00) Ekaterinburg", Selected = false },
new SelectListItem() { Value="Pakistan Standard Time", Text="(GMT+05:00) Islamabad, Karachi", Selected = false },
new SelectListItem() { Value="West Asia Standard Time", Text="(GMT+05:00) Tashkent", Selected = false },
new SelectListItem() { Value="India Standard Time", Text="(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi", Selected = false },
new SelectListItem() { Value="Sri Lanka Standard Time", Text="(GMT+05:30) Sri Jayawardenepura", Selected = false },
new SelectListItem() { Value="Nepal Standard Time", Text="(GMT+05:45) Kathmandu", Selected = false },
new SelectListItem() { Value="N. Central Asia Standard Time", Text="(GMT+06:00) Almaty, Novosibirsk", Selected = false },
new SelectListItem() { Value="Central Asia Standard Time", Text="(GMT+06:00) Astana, Dhaka", Selected = false },
new SelectListItem() { Value="Myanmar Standard Time", Text="(GMT+06:30) Yangon (Rangoon)", Selected = false },
new SelectListItem() { Value="SE Asia Standard Time", Text="(GMT+07:00) Bangkok, Hanoi, Jakarta", Selected = false },
new SelectListItem() { Value="North Asia Standard Time", Text="(GMT+07:00) Krasnoyarsk", Selected = false },
new SelectListItem() { Value="China Standard Time", Text="(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi", Selected = false },
new SelectListItem() { Value="North Asia East Standard Time", Text="(GMT+08:00) Irkutsk, Ulaan Bataar", Selected = false },
new SelectListItem() { Value="Singapore Standard Time", Text="(GMT+08:00) Kuala Lumpur, Singapore", Selected = false },
new SelectListItem() { Value="W. Australia Standard Time", Text="(GMT+08:00) Perth", Selected = false },
new SelectListItem() { Value="Taipei Standard Time", Text="(GMT+08:00) Taipei", Selected = false },
new SelectListItem() { Value="Tokyo Standard Time", Text="(GMT+09:00) Osaka, Sapporo, Tokyo", Selected = false },
new SelectListItem() { Value="Korea Standard Time", Text="(GMT+09:00) Seoul", Selected = false },
new SelectListItem() { Value="Yakutsk Standard Time", Text="(GMT+09:00) Yakutsk", Selected = false },
new SelectListItem() { Value="Cen. Australia Standard Time", Text="(GMT+09:30) Adelaide", Selected = false },
new SelectListItem() { Value="AUS Central Standard Time", Text="(GMT+09:30) Darwin", Selected = false },
new SelectListItem() { Value="E. Australia Standard Time", Text="(GMT+10:00) Brisbane", Selected = false },
new SelectListItem() { Value="AUS Eastern Standard Time", Text="(GMT+10:00) Canberra, Melbourne, Sydney", Selected = false },
new SelectListItem() { Value="West Pacific Standard Time", Text="(GMT+10:00) Guam, Port Moresby", Selected = false },
new SelectListItem() { Value="Tasmania Standard Time", Text="(GMT+10:00) Hobart", Selected = false },
new SelectListItem() { Value="Vladivostok Standard Time", Text="(GMT+10:00) Vladivostok", Selected = false },
new SelectListItem() { Value="Central Pacific Standard Time", Text="(GMT+11:00) Magadan, Solomon Is., New Caledonia", Selected = false },
new SelectListItem() { Value="New Zealand Standard Time", Text="(GMT+12:00) Auckland, Wellington", Selected = false },
new SelectListItem() { Value="Fiji Standard Time", Text="(GMT+12:00) Fiji, Kamchatka, Marshall Is.", Selected = false },
new SelectListItem() { Value="Tonga Standard Time", Text="(GMT+13:00) Nuku'alofa", Selected = false },
new SelectListItem() { Value="Azores Standard Time", Text="(GMT-01:00) Azores", Selected = false },
new SelectListItem() { Value="Cape Verde Standard Time", Text="(GMT-01:00) Cape Verde Is.", Selected = false },
new SelectListItem() { Value="Mid-Atlantic Standard Time", Text="(GMT-02:00) Mid-Atlantic", Selected = false },
new SelectListItem() { Value="E. South America Standard Time", Text="(GMT-03:00) Brasilia", Selected = false },
new SelectListItem() { Value="Argentina Standard Time", Text="(GMT-03:00) Buenos Aires", Selected = false },
new SelectListItem() { Value="SA Eastern Standard Time", Text="(GMT-03:00) Georgetown", Selected = false },
new SelectListItem() { Value="Greenland Standard Time", Text="(GMT-03:00) Greenland", Selected = false },
new SelectListItem() { Value="Montevideo Standard Time", Text="(GMT-03:00) Montevideo", Selected = false },
new SelectListItem() { Value="Newfoundland Standard Time", Text="(GMT-03:30) Newfoundland", Selected = false },
new SelectListItem() { Value="Atlantic Standard Time", Text="(GMT-04:00) Atlantic Time (Canada)", Selected = false },
new SelectListItem() { Value="SA Western Standard Time", Text="(GMT-04:00) La Paz", Selected = false },
new SelectListItem() { Value="Central Brazilian Standard Time", Text="(GMT-04:00) Manaus", Selected = false },
new SelectListItem() { Value="Pacific SA Standard Time", Text="(GMT-04:00) Santiago", Selected = false },
new SelectListItem() { Value="Venezuela Standard Time", Text="(GMT-04:30) Caracas", Selected = false },
new SelectListItem() { Value="SA Pacific Standard Time", Text="(GMT-05:00) Bogota, Lima, Quito, Rio Branco", Selected = false },
new SelectListItem() { Value="Eastern Standard Time", Text="(GMT-05:00) Eastern Time (US & Canada)", Selected = false },
new SelectListItem() { Value="US Eastern Standard Time", Text="(GMT-05:00) Indiana (East)", Selected = false },
new SelectListItem() { Value="Central America Standard Time", Text="(GMT-06:00) Central America", Selected = false },
new SelectListItem() { Value="Central Standard Time", Text="(GMT-06:00) Central Time (US & Canada)", Selected = false },
new SelectListItem() { Value="Central Standard Time (Mexico)", Text="(GMT-06:00) Guadalajara, Mexico City, Monterrey", Selected = false },
new SelectListItem() { Value="Canada Central Standard Time", Text="(GMT-06:00) Saskatchewan", Selected = false },
new SelectListItem() { Value="US Mountain Standard Time", Text="(GMT-07:00) Arizona", Selected = false },
new SelectListItem() { Value="Mountain Standard Time (Mexico)", Text="(GMT-07:00) Chihuahua, La Paz, Mazatlan", Selected = false },
new SelectListItem() { Value="Mountain Standard Time", Text="(GMT-07:00) Mountain Time (US & Canada)", Selected = false },
new SelectListItem() { Value="Pacific Standard Time", Text="(GMT-08:00) Pacific Time (US & Canada)", Selected = false },
new SelectListItem() { Value="Pacific Standard Time (Mexico)", Text="(GMT-08:00) Tijuana, Baja California", Selected = false },
new SelectListItem() { Value="Alaskan Standard Time", Text="(GMT-09:00) Alaska", Selected = false },
new SelectListItem() { Value="Hawaiian Standard Time", Text="(GMT-10:00) Hawaii", Selected = false },
new SelectListItem() { Value="Samoa Standard Time", Text="(GMT-11:00) Midway Island, Samoa", Selected = false },
new SelectListItem() { Value="Dateline Standard Time", Text="(GMT-12:00) International Date Line West", Selected = false }
}

Although for Razor you can of course just generate the options by looping through TimeZoneInfo.GetSystemTimeZones()

Somnambulate answered 25/6, 2013 at 14:44 Comment(8)
Do you have the code that generates this list ? I wonder how you output the GMT section.Merengue
Not sure what you mean Jeson. I used the code in the accepted answer above to get all the timezone, and then just put together than select options I provided by hand from that list.Somnambulate
Why hardcode the list if you can get it via var allTimeZones = TimeZoneInfo.GetSystemTimeZones(); ???Denna
Hard coding the list has the potential for leaving out perfectly valid values that are added over time! Not a good idea.Amyl
this seems like a really bad idea to hardcode into the view. prone to human error and a real pain to maintain.Mariellemariellen
It (the .NET code) was added here so it could be cut and pasted thereby minimizing human error. That being said, the solution also suggests looping through TimeZoneInfo.GetSystemTimeZones(). Not sure how often time zones definitions change (and whether such changes are reflected in .NET immediately), so not sure how much 'maintenance' would actually be required.Somnambulate
Beware, the GMT offsets shown here are not constant. They will vary as each of the time zones switch to and from daylight saving.Rampageous
Some suggest it's a bad idea to hardcode a list of timezones, and they are correct most of the time. Now, if I had access to an hardcoded list of defined timezones at the time the binaries I'm working on today were created, I could compare the values and make the appropriate calibrations no matter I'm working on Win7, Win10 or Win24. I just can't. Working with historical geodata sucks man...Neckpiece
S
21

And heres a Json version I converted from ProfNimrod's answer...

{
    tZCode : "Morocco Standard Time",
    tZDesc : "(GMT) Casablanca"
},
{
    tZCode : "GMT Standard Time",
    tZDesc : "(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London"
},
{
    tZCode : "Greenwich Standard Time",
    tZDesc : "(GMT) Monrovia, Reykjavik"
},
{
    tZCode : "W. Europe Standard Time",
    tZDesc : "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"
},
{
    tZCode : "Central Europe Standard Time",
    tZDesc : "(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague"
},
{
    tZCode : "Romance Standard Time",
    tZDesc : "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris"
},
{
    tZCode : "Central European Standard Time",
    tZDesc : "(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb"
},
{
    tZCode : "W. Central Africa Standard Time",
    tZDesc : "(GMT+01:00) West Central Africa"
},
{
    tZCode : "Jordan Standard Time",
    tZDesc : "(GMT+02:00) Amman"
},
{
    tZCode : "GTB Standard Time",
    tZDesc : "(GMT+02:00) Athens, Bucharest, Istanbul"
},
{
    tZCode : "Middle East Standard Time",
    tZDesc : "(GMT+02:00) Beirut"
},
{
    tZCode : "Egypt Standard Time",
    tZDesc : "(GMT+02:00) Cairo"
},
{
    tZCode : "South Africa Standard Time",
    tZDesc : "(GMT+02:00) Harare, Pretoria"
},
{
    tZCode : "FLE Standard Time",
    tZDesc : "(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius"
},
{
    tZCode : "Israel Standard Time",
    tZDesc : "(GMT+02:00) Jerusalem"
},
{
    tZCode : "E. Europe Standard Time",
    tZDesc : "(GMT+02:00) Minsk"
},
{
    tZCode : "Namibia Standard Time",
    tZDesc : "(GMT+02:00) Windhoek"
},
{
    tZCode : "Arabic Standard Time",
    tZDesc : "(GMT+03:00) Baghdad"
},
{
    tZCode : "Arab Standard Time",
    tZDesc : "(GMT+03:00) Kuwait, Riyadh"
},
{
    tZCode : "Russian Standard Time",
    tZDesc : "(GMT+03:00) Moscow, St. Petersburg, Volgograd"
},
{
    tZCode : "E. Africa Standard Time",
    tZDesc : "(GMT+03:00) Nairobi"
},
{
    tZCode : "Georgian Standard Time",
    tZDesc : "(GMT+03:00) Tbilisi"
},
{
    tZCode : "Iran Standard Time",
    tZDesc : "(GMT+03:30) Tehran"
},
{
    tZCode : "Arabian Standard Time",
    tZDesc : "(GMT+04:00) Abu Dhabi, Muscat"
},
{
    tZCode : "Azerbaijan Standard Time",
    tZDesc : "(GMT+04:00) Baku"
},
{
    tZCode : "Mauritius Standard Time",
    tZDesc : "(GMT+04:00) Port Louis"
},
{
    tZCode : "Caucasus Standard Time",
    tZDesc : "(GMT+04:00) Yerevan"
},
{
    tZCode : "Afghanistan Standard Time",
    tZDesc : "(GMT+04:30) Kabul"
},
{
    tZCode : "Ekaterinburg Standard Time",
    tZDesc : "(GMT+05:00) Ekaterinburg"
},
{
    tZCode : "Pakistan Standard Time",
    tZDesc : "(GMT+05:00) Islamabad, Karachi"
},
{
    tZCode : "West Asia Standard Time",
    tZDesc : "(GMT+05:00) Tashkent"
},
{
    tZCode : "India Standard Time",
    tZDesc : "(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi"
},
{
    tZCode : "Sri Lanka Standard Time",
    tZDesc : "(GMT+05:30) Sri Jayawardenepura"
},
{
    tZCode : "Nepal Standard Time",
    tZDesc : "(GMT+05:45) Kathmandu"
},
{
    tZCode : "N. Central Asia Standard Time",
    tZDesc : "(GMT+06:00) Almaty, Novosibirsk"
},
{
    tZCode : "Central Asia Standard Time",
    tZDesc : "(GMT+06:00) Astana, Dhaka"
},
{
    tZCode : "Myanmar Standard Time",
    tZDesc : "(GMT+06:30) Yangon (Rangoon)"
},
{
    tZCode : "SE Asia Standard Time",
    tZDesc : "(GMT+07:00) Bangkok, Hanoi, Jakarta"
},
{
    tZCode : "North Asia Standard Time",
    tZDesc : "(GMT+07:00) Krasnoyarsk"
},
{
    tZCode : "China Standard Time",
    tZDesc : "(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi"
},
{
    tZCode : "North Asia East Standard Time",
    tZDesc : "(GMT+08:00) Irkutsk, Ulaan Bataar"
},
{
    tZCode : "Singapore Standard Time",
    tZDesc : "(GMT+08:00) Kuala Lumpur, Singapore"
},
{
    tZCode : "W. Australia Standard Time",
    tZDesc : "(GMT+08:00) Perth"
},
{
    tZCode : "Taipei Standard Time",
    tZDesc : "(GMT+08:00) Taipei"
},
{
    tZCode : "Tokyo Standard Time",
    tZDesc : "(GMT+09:00) Osaka, Sapporo, Tokyo"
},
{
    tZCode : "Korea Standard Time",
    tZDesc : "(GMT+09:00) Seoul"
},
{
    tZCode : "Yakutsk Standard Time",
    tZDesc : "(GMT+09:00) Yakutsk"
},
{
    tZCode : "Cen. Australia Standard Time",
    tZDesc : "(GMT+09:30) Adelaide"
},
{
    tZCode : "AUS Central Standard Time",
    tZDesc : "(GMT+09:30) Darwin"
},
{
    tZCode : "E. Australia Standard Time",
    tZDesc : "(GMT+10:00) Brisbane"
},
{
    tZCode : "AUS Eastern Standard Time",
    tZDesc : "(GMT+10:00) Canberra, Melbourne, Sydney"
},
{
    tZCode : "West Pacific Standard Time",
    tZDesc : "(GMT+10:00) Guam, Port Moresby"
},
{
    tZCode : "Tasmania Standard Time",
    tZDesc : "(GMT+10:00) Hobart"
},
{
    tZCode : "Vladivostok Standard Time",
    tZDesc : "(GMT+10:00) Vladivostok"
},
{
    tZCode : "Central Pacific Standard Time",
    tZDesc : "(GMT+11:00) Magadan, Solomon Is., New Caledonia"
},
{
    tZCode : "New Zealand Standard Time",
    tZDesc : "(GMT+12:00) Auckland, Wellington"
},
{
    tZCode : "Fiji Standard Time",
    tZDesc : "(GMT+12:00) Fiji, Kamchatka, Marshall Is."
},
{
    tZCode : "Tonga Standard Time",
    tZDesc : "(GMT+13:00) Nuku'alofa"
},
{
    tZCode : "Azores Standard Time",
    tZDesc : "(GMT-01:00) Azores"
},
{
    tZCode : "Cape Verde Standard Time",
    tZDesc : "(GMT-01:00) Cape Verde Is."
},
{
    tZCode : "Mid-Atlantic Standard Time",
    tZDesc : "(GMT-02:00) Mid-Atlantic"
},
{
    tZCode : "E. South America Standard Time",
    tZDesc : "(GMT-03:00) Brasilia"
},
{
    tZCode : "Argentina Standard Time",
    tZDesc : "(GMT-03:00) Buenos Aires"
},
{
    tZCode : "SA Eastern Standard Time",
    tZDesc : "(GMT-03:00) Georgetown"
},
{
    tZCode : "Greenland Standard Time",
    tZDesc : "(GMT-03:00) Greenland"
},
{
    tZCode : "Montevideo Standard Time",
    tZDesc : "(GMT-03:00) Montevideo"
},
{
    tZCode : "Newfoundland Standard Time",
    tZDesc : "(GMT-03:30) Newfoundland"
},
{
    tZCode : "Atlantic Standard Time",
    tZDesc : "(GMT-04:00) Atlantic Time (Canada)"
},
{
    tZCode : "SA Western Standard Time",
    tZDesc : "(GMT-04:00) La Paz"
},
{
    tZCode : "Central Brazilian Standard Time",
    tZDesc : "(GMT-04:00) Manaus"
},
{
    tZCode : "Pacific SA Standard Time",
    tZDesc : "(GMT-04:00) Santiago"
},
{
    tZCode : "Venezuela Standard Time",
    tZDesc : "(GMT-04:30) Caracas"
},
{
    tZCode : "SA Pacific Standard Time",
    tZDesc : "(GMT-05:00) Bogota, Lima, Quito, Rio Branco"
},
{
    tZCode : "Eastern Standard Time",
    tZDesc : "(GMT-05:00) Eastern Time (US & Canada)"
},
{
    tZCode : "US Eastern Standard Time",
    tZDesc : "(GMT-05:00) Indiana (East)"
},
{
    tZCode : "Central America Standard Time",
    tZDesc : "(GMT-06:00) Central America"
},
{
    tZCode : "Central Standard Time",
    tZDesc : "(GMT-06:00) Central Time (US & Canada)"
},
{
    tZCode : "Central Standard Time (Mexico)",
    tZDesc : "(GMT-06:00) Guadalajara, Mexico City, Monterrey"
},
{
    tZCode : "Canada Central Standard Time",
    tZDesc : "(GMT-06:00) Saskatchewan"
},
{
    tZCode : "US Mountain Standard Time",
    tZDesc : "(GMT-07:00) Arizona"
},
{
    tZCode : "Mountain Standard Time (Mexico)",
    tZDesc : "(GMT-07:00) Chihuahua, La Paz, Mazatlan"
},
{
    tZCode : "Mountain Standard Time",
    tZDesc : "(GMT-07:00) Mountain Time (US & Canada)"
},
{
    tZCode : "Pacific Standard Time",
    tZDesc : "(GMT-08:00) Pacific Time (US & Canada)"
},
{
    tZCode : "Pacific Standard Time (Mexico)",
    tZDesc : "(GMT-08:00) Tijuana, Baja California"
},
{
    tZCode : "Alaskan Standard Time",
    tZDesc : "(GMT-09:00) Alaska"
},
{
    tZCode : "Hawaiian Standard Time",
    tZDesc : "(GMT-10:00) Hawaii"
},
{
    tZCode : "Samoa Standard Time",
    tZDesc : "(GMT-11:00) Midway Island, Samoa"
},
{
    tZCode : "Dateline Standard Time",
    tZDesc : "(GMT-12:00) International Date Line West"
}
Sypher answered 3/9, 2016 at 10:28 Comment(0)
S
20

Here's the link you're looking for:

C# System timeZoneID's

Scorecard answered 25/7, 2012 at 21:5 Comment(0)
K
12

From MSDN

ReadOnlyCollection<TimeZoneInfo> zones = TimeZoneInfo.GetSystemTimeZones();
Console.WriteLine("The local system has the following {0} time zones", zones.Count);
foreach (TimeZoneInfo zone in zones)
   Console.WriteLine(zone.Id);
Konya answered 26/10, 2011 at 20:19 Comment(5)
That isn't a list of them... I don't want to have to go in and programmatically list them any time I want to use them.Josefjosefa
@user976921: This gives you a list of them as defined by your local machine. You could even define custom ones, so I'm not exactly sure how much more comprehensive of a list you could possibly want.Konya
@user976921: run Marc's code, then copy from the output window to a text file.Eat
That will give me a list if I make a program to output them. The thing is I want a list I can quickly reference and not have to keep up with a program just to show them to me every time I want them. I just want a quick reference link I can go to anytime I want and see the full comprehensive list.Josefjosefa
@Konya +1 for linqpad... Never heard of it before but it looks extremely useful! Thanks!Bernardinebernardo
M
8

You will find complete list of time zone with its GMToffsets here and you can use "Name of Time Zone" column value to find time zone by ID

e.g

TimeZoneInfo objTimeZoneInfo = TimeZoneInfo.FindTimeZoneById("Dateline Standard Time");

You will get time zone info class that contains dateline standard time time zone which is used for GMT-12:00.

Mcarthur answered 17/12, 2012 at 7:28 Comment(2)
Rather, TimeZoneInfo.FindSystemTimeZoneById.Quill
Oddly, on the page referred to a 'here' (msdn.microsoft.com/en-us/library/…), the list may or may not be complete but is not correct. Check out the entry for problem-child Arizona (U.S.). The entry on the page says "U.S. Mountain Standard Time" but that value causes a TimeZoneNotFoundException if you use it in FindTimeZoneById. If you check the program output above, you see the correct value is "US Mountain Standard Time" (no periods). Looks like the values on the page were 'cleaned up' at some point and can't be trusted.Parasol
M
6

I know it's old and old question but Microsoft appears to have provided this through MSDN now.

http://msdn.microsoft.com/en-us/library/gg154758.aspx

Maze answered 15/12, 2014 at 15:17 Comment(1)
That list is specific to Windows Embedded Compact 2013.Alic
A
4

I suspect this is what most people are looking for:

Microsoft Time Zone Index Values

Hopefully MS keeps it up to date even after XP.

Agamic answered 10/3, 2014 at 21:59 Comment(3)
Just a note on this link, for whatever reason, they seem to have published the IDs of the Timezones slightly wrong. For instance, they have U.S. rather than just USManicurist
There's a column with a numerical index... Anybody know if I can get a timezone by that index somehow instead of relying on the string name?Varnado
Do you know what these 'Time Zone Index' IDs are used for? Do they only apply to Windows XP and before?Litta
P
3

Here is the list of Timezone(s) from microsoft enter image description here

Psephology answered 4/12, 2018 at 14:29 Comment(1)
here is the link; support.microsoft.com/en-us/help/973627/…Torino
B
1
var timeZoneInfos = TimeZoneInfo.GetSystemTimeZones();

The above gives you a list of timezones, which includes the ids.

Biserrate answered 26/10, 2011 at 20:21 Comment(0)
P
1

List of time zone identifiers, included by default in Windows XP and Vista: Finding the Time Zones Defined on a Local System

Piezochemistry answered 1/5, 2013 at 18:36 Comment(0)
A
0
DateTime dt;
TimeZoneInfo tzf;
tzf = TimeZoneInfo.FindSystemTimeZoneById("TimeZone String");
dt = TimeZoneInfo.ConvertTime(DateTime.Now, tzf);
lbltime.Text = dt.ToString();
Ausgleich answered 24/12, 2014 at 5:1 Comment(0)
L
0

This is the code fully tested and working for me. You can use it just copy and paste in your aspx page and cs page.

This is my blog you can download full code here. thanks.

http://www.c-sharpcorner.com/blogs/display-all-the-timezone-information-in-dropdown-list-of-a-local-system-using-c-sharp-with-asp-net

<form id="form1" runat="server">
    <div style="font-size: 30px; padding: 25px; text-align: center;">
        Get Current Date And Time Of All TimeZones
    </div>
    <hr />
    <div style="font-size: 18px; padding: 25px; text-align: center;">
        <div class="clsLeft">
            Select TimeZone :-
        </div>
        <div class="clsRight">
            <asp:DropDownList ID="ddlTimeZone" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlTimeZone_SelectedIndexChanged"
                Font-Size="18px">
            </asp:DropDownList>
        </div>
        <div class="clearspace">
        </div>
        <div class="clsLeft">
            Selected TimeZone :-
        </div>
        <div class="clsRight">
            <asp:Label ID="lblTimeZone" runat="server" Text="" />
        </div>
        <div class="clearspace">
        </div>
        <div class="clsLeft">
            Current Date And Time :-
        </div>
        <div class="clsRight">
            <asp:Label ID="lblCurrentDateTime" runat="server" Text="" />
        </div>
    </div>
    <p>
        &nbsp;</p>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
    </form>
 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindTimeZone();
            GetSelectedTimeZone();
        }
    }

    protected void ddlTimeZone_SelectedIndexChanged(object sender, EventArgs e)
    {
        GetSelectedTimeZone();
    }

    /// <summary>
    /// Get all timezone from local system and bind it in dropdownlist
    /// </summary>
    private void BindTimeZone()
    {
        foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
        {
            ddlTimeZone.Items.Add(new ListItem(z.DisplayName, z.Id));
        }
    }

    /// <summary>
    /// Get selected timezone and current date & time
    /// </summary>
    private void GetSelectedTimeZone()
    {
        DateTimeOffset newTime = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(ddlTimeZone.SelectedValue));
        //DateTimeOffset newTime2 = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(ddlTimeZone.SelectedValue));
        lblTimeZone.Text = ddlTimeZone.SelectedItem.Text;
        lblCurrentDateTime.Text = newTime.ToString();
        string str;
        str = lblCurrentDateTime.Text;
        string s=str.Substring(0, 10);
        DateTime dt = new DateTime();
        dt = Convert.ToDateTime(s);
       // Response.Write(dt.ToString());
        Response.Write(ddlTimeZone.SelectedValue);

    }
Lusaka answered 19/1, 2018 at 11:16 Comment(0)
D
0

This is for SelectListItem in C# (asp .net)

You can write code in backend:

public static List<SelectListItem> GetTimezoneList()
{
    try
    {
        // list of timezone
        List<SelectListItem> timezoneList = new List<SelectListItem>();

        timezoneList.Add(new SelectListItem() { Value = "", Text = "Select TimeZone...", Selected = false });
                
        var timezoneInfo = TimeZoneInfo.GetSystemTimeZones();
                
        foreach (var item in timezoneInfo)
        {
            timezoneList.Add(new SelectListItem() 
            {
                Value = item.StandardName, Text = item.DisplayName, Selected = false });
            }
            return timezoneList;
        }
    }
    catch (Exception e)
    {
        throw e;
    }
}

And in Front-end side

@Html.DropDownListFor(s => s.TimeZone, YourbackendServiceName.GetTimezoneList(), new { @class = "form-control input-md" })

this will give you all timezone DisplayName ... i.e. India Standard Time in Drop Down List

Declass answered 13/11, 2021 at 8:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.