Working with .Net TimeZone Information and Converting Times

A comprehensive list of .Net TimeZone information used for localising .Net applications in conjunction with the CultureInfo class. Timezones are used to help maintain local time and UTC and for conversion between the two.

By Tim Trott | C# ASP.Net MVC | July 29, 2010
2,211 words, estimated reading time 8 minutes.

It is becoming increasingly important for any application that works with dates and times to handle differences between time zones. An application can no longer assume that all times can be expressed in the local time, which is the time available from the DateTime structure. For example, a Web page that displays the current time in the eastern part of the United States will lack credibility with a customer in eastern Asia.

Coordinated Universal Time (UTC) is a high-precision, atomic time standard. The world's time zones are expressed as positive or negative offsets from UTC. Thus, UTC provides a kind of time-zone-free or time-zone-neutral time. The use of UTC is recommended when a date and time's portability across computers is important.

The following code converts the current local time to UTC and displays the result to the console.

C#
DateTime dateNow = DateTime.Now;
Console.WriteLine("The date and time are {0} UTC.", TimeZoneInfo.ConvertTimeToUtc(dateNow));

If the date and time values do not represent either the local time or UTC, the ToUniversalTime method will likely return an erroneous result. However, you can use the TimeZoneInfo.ConvertTimeToUtc method to convert the date and time from a specified time zone. The following code uses the TimeZoneInfo.ConvertTimeToUtc method to convert Eastern Standard Time to UTC.

Converting A Time to UTC Timezone

Timezone ID can be found in the table at the bottom of this article.

C#
DateTime easternTime = new DateTime(2007, 01, 02, 12, 16, 00);
string easternZoneId = "Eastern Standard Time";
try
{
   TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById(easternZoneId);
   Console.WriteLine("The date and time are {0} UTC.", 
                     TimeZoneInfo.ConvertTimeToUtc(easternTime, easternZone));
}
catch (TimeZoneNotFoundException)
{
   Console.WriteLine("Unable to find the {0} zone in the registry.", 
                     easternZoneId);
}                           
catch (InvalidTimeZoneException)
{
   Console.WriteLine("Registry data on the {0} zone has been corrupted.", 
                     easternZoneId);
}

Converting A Time Between Two Different Time Zones

The following example uses the ConvertTime method to convert from Hawaiian Standard Time to local time.

C#
DateTime hwTime = new DateTime(2007, 02, 01, 08, 00, 00);
try
{
   TimeZoneInfo hwZone = TimeZoneInfo.FindSystemTimeZoneById("Hawaiian Standard Time");
   Console.WriteLine("{0} {1} is {2} local time.", 
           hwTime, 
           hwZone.IsDaylightSavingTime(hwTime) ? hwZone.DaylightName : hwZone.StandardName, 
           TimeZoneInfo.ConvertTime(hwTime, hwZone, TimeZoneInfo.Local));
}
catch (TimeZoneNotFoundException)
{
   Console.WriteLine("The registry does not define the Hawaiian Standard Time zone.");
}                           
catch (InvalidTimeZoneException)
{
   Console.WriteLine("Registry data on the Hawaiian Standard Time zone has been corrupted.");
}

List of .Net Timezone Information Values

Display Name UTC Offset Standard Name Daylight Name Supports Daylight Savings
(UTC-12:00) International Date Line West -12:00:00 Dateline Standard Time Dateline Daylight Time False
(UTC-11:00) Coordinated Universal Time-11 -11:00:00 UTC-11 UTC-11 False
(UTC-10:00) Aleutian Islands -10:00:00 Aleutian Standard Time Aleutian Daylight Time True
(UTC-10:00) Hawaii -10:00:00 Hawaiian Standard Time Hawaiian Daylight Time False
(UTC-09:30) Marquesas Islands -09:30:00 Marquesas Standard Time Marquesas Daylight Time False
(UTC-09:00) Alaska -09:00:00 Alaskan Standard Time Alaskan Daylight Time True
(UTC-09:00) Coordinated Universal Time-09 -09:00:00 UTC-09 UTC-09 False
(UTC-08:00) Baja California -08:00:00 Pacific Standard Time (Mexico) Pacific Daylight Time (Mexico) True
(UTC-08:00) Coordinated Universal Time-08 -08:00:00 UTC-08 UTC-08 False
(UTC-08:00) Pacific Time (US & Canada) -08:00:00 Pacific Standard Time Pacific Daylight Time True
(UTC-07:00) Arizona -07:00:00 US Mountain Standard Time US Mountain Daylight Time False
(UTC-07:00) Chihuahua, La Paz, Mazatlan -07:00:00 Mountain Standard Time (Mexico) Mountain Daylight Time (Mexico) True
(UTC-07:00) Mountain Time (US & Canada) -07:00:00 Mountain Standard Time Mountain Daylight Time True
(UTC-06:00) Central America -06:00:00 Central America Standard Time Central America Daylight Time False
(UTC-06:00) Central Time (US & Canada) -06:00:00 Central Standard Time Central Daylight Time True
(UTC-06:00) Easter Island -06:00:00 Easter Island Standard Time Easter Island Daylight Time True
(UTC-06:00) Guadalajara, Mexico City, Monterrey -06:00:00 Central Standard Time (Mexico) Central Daylight Time (Mexico) True
(UTC-06:00) Saskatchewan -06:00:00 Canada Central Standard Time Canada Central Daylight Time False
(UTC-05:00) Bogota, Lima, Quito, Rio Branco -05:00:00 SA Pacific Standard Time SA Pacific Daylight Time False
(UTC-05:00) Chetumal -05:00:00 Eastern Standard Time (Mexico) Eastern Daylight Time (Mexico) True
(UTC-05:00) Eastern Time (US & Canada) -05:00:00 Eastern Standard Time Eastern Daylight Time True
(UTC-05:00) Haiti -05:00:00 Haiti Standard Time Haiti Daylight Time True
(UTC-05:00) Havana -05:00:00 Cuba Standard Time Cuba Daylight Time True
(UTC-05:00) Indiana (East) -05:00:00 US Eastern Standard Time US Eastern Daylight Time True
(UTC-05:00) Turks and Caicos -05:00:00 Turks and Caicos Standard Time Turks and Caicos Daylight Time True
(UTC-04:00) Asuncion -04:00:00 Paraguay Standard Time Paraguay Daylight Time True
(UTC-04:00) Atlantic Time (Canada) -04:00:00 Atlantic Standard Time Atlantic Daylight Time True
(UTC-04:00) Caracas -04:00:00 Venezuela Standard Time Venezuela Daylight Time True
(UTC-04:00) Cuiaba -04:00:00 Central Brazilian Standard Time Central Brazilian Daylight Time True
(UTC-04:00) Georgetown, La Paz, Manaus, San Juan -04:00:00 SA Western Standard Time SA Western Daylight Time False
(UTC-04:00) Santiago -04:00:00 Pacific SA Standard Time Pacific SA Daylight Time True
(UTC-03:30) Newfoundland -03:30:00 Newfoundland Standard Time Newfoundland Daylight Time True
(UTC-03:00) Araguaina -03:00:00 Tocantins Standard Time Tocantins Daylight Time True
(UTC-03:00) Brasilia -03:00:00 E. South America Standard Time E. South America Daylight Time True
(UTC-03:00) Cayenne, Fortaleza -03:00:00 SA Eastern Standard Time SA Eastern Daylight Time False
(UTC-03:00) City of Buenos Aires -03:00:00 Argentina Standard Time Argentina Daylight Time True
(UTC-03:00) Greenland -03:00:00 Greenland Standard Time Greenland Daylight Time True
(UTC-03:00) Montevideo -03:00:00 Montevideo Standard Time Montevideo Daylight Time True
(UTC-03:00) Punta Arenas -03:00:00 Magallanes Standard Time Magallanes Daylight Time True
(UTC-03:00) Saint Pierre and Miquelon -03:00:00 Saint Pierre Standard Time Saint Pierre Daylight Time True
(UTC-03:00) Salvador -03:00:00 Bahia Standard Time Bahia Daylight Time True
(UTC-02:00) Coordinated Universal Time-02 -02:00:00 UTC-02 UTC-02 False
(UTC-02:00) Mid-Atlantic - Old -02:00:00 Mid-Atlantic Standard Time Mid-Atlantic Daylight Time True
(UTC-01:00) Azores -01:00:00 Azores Standard Time Azores Daylight Time True
(UTC-01:00) Cabo Verde Is. -01:00:00 Cabo Verde Standard Time Cabo Verde Daylight Time False
(UTC) Coordinated Universal Time 00:00:00 Coordinated Universal Time Coordinated Universal Time False
(UTC+00:00) Dublin, Edinburgh, Lisbon, London 00:00:00 GMT Standard Time GMT Daylight Time True
(UTC+00:00) Monrovia, Reykjavik 00:00:00 Greenwich Standard Time Greenwich Daylight Time False
(UTC+00:00) Sao Tome 00:00:00 Sao Tome Standard Time Sao Tome Daylight Time True
(UTC+01:00) Casablanca 00:00:00 Morocco Standard Time Morocco Daylight Time True
(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna 01:00:00 W. Europe Standard Time W. Europe Daylight Time True
(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague 01:00:00 Central Europe Standard Time Central Europe Daylight Time True
(UTC+01:00) Brussels, Copenhagen, Madrid, Paris 01:00:00 Romance Standard Time Romance Daylight Time True
(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb 01:00:00 Central European Standard Time Central European Daylight Time True
(UTC+01:00) West Central Africa 01:00:00 W. Central Africa Standard Time W. Central Africa Daylight Time False
(UTC+02:00) Amman 02:00:00 Jordan Standard Time Jordan Daylight Time True
(UTC+02:00) Athens, Bucharest 02:00:00 GTB Standard Time GTB Daylight Time True
(UTC+02:00) Beirut 02:00:00 Middle East Standard Time Middle East Daylight Time True
(UTC+02:00) Cairo 02:00:00 Egypt Standard Time Egypt Daylight Time True
(UTC+02:00) Chisinau 02:00:00 E. Europe Standard Time E. Europe Daylight Time True
(UTC+02:00) Damascus 02:00:00 Syria Standard Time Syria Daylight Time True
(UTC+02:00) Gaza, Hebron 02:00:00 West Bank Gaza Standard Time West Bank Gaza Daylight Time True
(UTC+02:00) Harare, Pretoria 02:00:00 South Africa Standard Time South Africa Daylight Time False
(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius 02:00:00 FLE Standard Time FLE Daylight Time True
(UTC+02:00) Jerusalem 02:00:00 Jerusalem Standard Time Jerusalem Daylight Time True
(UTC+02:00) Kaliningrad 02:00:00 Russia TZ 1 Standard Time Russia TZ 1 Daylight Time True
(UTC+02:00) Khartoum 02:00:00 Sudan Standard Time Sudan Daylight Time True
(UTC+02:00) Tripoli 02:00:00 Libya Standard Time Libya Daylight Time True
(UTC+02:00) Windhoek 02:00:00 Namibia Standard Time Namibia Daylight Time True
(UTC+03:00) Baghdad 03:00:00 Arabic Standard Time Arabic Daylight Time True
(UTC+03:00) Istanbul 03:00:00 Turkey Standard Time Turkey Daylight Time True
(UTC+03:00) Kuwait, Riyadh 03:00:00 Arab Standard Time Arab Daylight Time False
(UTC+03:00) Minsk 03:00:00 Belarus Standard Time Belarus Daylight Time True
(UTC+03:00) Moscow, St. Petersburg 03:00:00 Russia TZ 2 Standard Time Russia TZ 2 Daylight Time True
(UTC+03:00) Nairobi 03:00:00 E. Africa Standard Time E. Africa Daylight Time False
(UTC+03:30) Tehran 03:30:00 Iran Standard Time Iran Daylight Time True
(UTC+04:00) Abu Dhabi, Muscat 04:00:00 Arabian Standard Time Arabian Daylight Time False
(UTC+04:00) Astrakhan, Ulyanovsk 04:00:00 Astrakhan Standard Time Astrakhan Daylight Time True
(UTC+04:00) Baku 04:00:00 Azerbaijan Standard Time Azerbaijan Daylight Time True
(UTC+04:00) Izhevsk, Samara 04:00:00 Russia TZ 3 Standard Time Russia TZ 3 Daylight Time True
(UTC+04:00) Port Louis 04:00:00 Mauritius Standard Time Mauritius Daylight Time True
(UTC+04:00) Saratov 04:00:00 Saratov Standard Time Saratov Daylight Time True
(UTC+04:00) Tbilisi 04:00:00 Georgian Standard Time Georgian Daylight Time False
(UTC+04:00) Volgograd 04:00:00 Volgograd Standard Time Volgograd Daylight Time True
(UTC+04:00) Yerevan 04:00:00 Caucasus Standard Time Caucasus Daylight Time True
(UTC+04:30) Kabul 04:30:00 Afghanistan Standard Time Afghanistan Daylight Time False
(UTC+05:00) Ashgabat, Tashkent 05:00:00 West Asia Standard Time West Asia Daylight Time False
(UTC+05:00) Ekaterinburg 05:00:00 Russia TZ 4 Standard Time Russia TZ 4 Daylight Time True
(UTC+05:00) Islamabad, Karachi 05:00:00 Pakistan Standard Time Pakistan Daylight Time True
(UTC+05:00) Qyzylorda 05:00:00 Qyzylorda Standard Time Qyzylorda Daylight Time True
(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi 05:30:00 India Standard Time India Daylight Time False
(UTC+05:30) Sri Jayawardenepura 05:30:00 Sri Lanka Standard Time Sri Lanka Daylight Time False
(UTC+05:45) Kathmandu 05:45:00 Nepal Standard Time Nepal Daylight Time False
(UTC+06:00) Astana 06:00:00 Central Asia Standard Time Central Asia Daylight Time False
(UTC+06:00) Dhaka 06:00:00 Bangladesh Standard Time Bangladesh Daylight Time True
(UTC+06:00) Omsk 06:00:00 Omsk Standard Time Omsk Daylight Time True
(UTC+06:30) Yangon (Rangoon) 06:30:00 Myanmar Standard Time Myanmar Daylight Time False
(UTC+07:00) Bangkok, Hanoi, Jakarta 07:00:00 SE Asia Standard Time SE Asia Daylight Time False
(UTC+07:00) Barnaul, Gorno-Altaysk 07:00:00 Altai Standard Time Altai Daylight Time True
(UTC+07:00) Hovd 07:00:00 W. Mongolia Standard Time W. Mongolia Daylight Time True
(UTC+07:00) Krasnoyarsk 07:00:00 Russia TZ 6 Standard Time Russia TZ 6 Daylight Time True
(UTC+07:00) Novosibirsk 07:00:00 Novosibirsk Standard Time Novosibirsk Daylight Time True
(UTC+07:00) Tomsk 07:00:00 Tomsk Standard Time Tomsk Daylight Time True
(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi 08:00:00 China Standard Time China Daylight Time False
(UTC+08:00) Irkutsk 08:00:00 Russia TZ 7 Standard Time Russia TZ 7 Daylight Time True
(UTC+08:00) Kuala Lumpur, Singapore 08:00:00 Malay Peninsula Standard Time Malay Peninsula Daylight Time False
(UTC+08:00) Perth 08:00:00 W. Australia Standard Time W. Australia Daylight Time True
(UTC+08:00) Taipei 08:00:00 Taipei Standard Time Taipei Daylight Time False
(UTC+08:00) Ulaanbaatar 08:00:00 Ulaanbaatar Standard Time Ulaanbaatar Daylight Time True
(UTC+08:45) Eucla 08:45:00 Aus Central W. Standard Time Aus Central W. Daylight Time False
(UTC+09:00) Chita 09:00:00 Transbaikal Standard Time Transbaikal Daylight Time True
(UTC+09:00) Osaka, Sapporo, Tokyo 09:00:00 Tokyo Standard Time Tokyo Daylight Time False
(UTC+09:00) Pyongyang 09:00:00 North Korea Standard Time North Korea Daylight Time True
(UTC+09:00) Seoul 09:00:00 Korea Standard Time Korea Daylight Time False
(UTC+09:00) Yakutsk 09:00:00 Russia TZ 8 Standard Time Russia TZ 8 Daylight Time True
(UTC+09:30) Adelaide 09:30:00 Cen. Australia Standard Time Cen. Australia Daylight Time True
(UTC+09:30) Darwin 09:30:00 AUS Central Standard Time AUS Central Daylight Time False
(UTC+10:00) Brisbane 10:00:00 E. Australia Standard Time E. Australia Daylight Time False
(UTC+10:00) Canberra, Melbourne, Sydney 10:00:00 AUS Eastern Standard Time AUS Eastern Daylight Time True
(UTC+10:00) Guam, Port Moresby 10:00:00 West Pacific Standard Time West Pacific Daylight Time False
(UTC+10:00) Hobart 10:00:00 Tasmania Standard Time Tasmania Daylight Time True
(UTC+10:00) Vladivostok 10:00:00 Russia TZ 9 Standard Time Russia TZ 9 Daylight Time True
(UTC+10:30) Lord Howe Island 10:30:00 Lord Howe Standard Time Lord Howe Daylight Time True
(UTC+11:00) Bougainville Island 11:00:00 Bougainville Standard Time Bougainville Daylight Time True
(UTC+11:00) Chokurdakh 11:00:00 Russia TZ 10 Standard Time Russia TZ 10 Daylight Time True
(UTC+11:00) Magadan 11:00:00 Magadan Standard Time Magadan Daylight Time True
(UTC+11:00) Norfolk Island 11:00:00 Norfolk Standard Time Norfolk Daylight Time True
(UTC+11:00) Sakhalin 11:00:00 Sakhalin Standard Time Sakhalin Daylight Time True
(UTC+11:00) Solomon Is., New Caledonia 11:00:00 Central Pacific Standard Time Central Pacific Daylight Time False
(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky 12:00:00 Russia TZ 11 Standard Time Russia TZ 11 Daylight Time True
(UTC+12:00) Auckland, Wellington 12:00:00 New Zealand Standard Time New Zealand Daylight Time True
(UTC+12:00) Coordinated Universal Time+12 12:00:00 UTC+12 UTC+12 False
(UTC+12:00) Fiji 12:00:00 Fiji Standard Time Fiji Daylight Time True
(UTC+12:00) Petropavlovsk-Kamchatsky - Old 12:00:00 Kamchatka Standard Time Kamchatka Daylight Time True
(UTC+12:45) Chatham Islands 12:45:00 Chatham Islands Standard Time Chatham Islands Daylight Time True
(UTC+13:00) Coordinated Universal Time+13 13:00:00 UTC+13 UTC+13 False
(UTC+13:00) Nuku'alofa 13:00:00 Tonga Standard Time Tonga Daylight Time True
(UTC+13:00) Samoa 13:00:00 Samoa Standard Time Samoa Daylight Time True
(UTC+14:00) Kiritimati Island 14:00:00 Line Islands Standard Time Line Islands Daylight Time False

How Do I Enumerate All Timezones in .NET?

Use this code retirnve all the Timezones in .Net programatically.

C#
ReadOnlyCollection<TimeZoneInfo> tz;
tz = TimeZoneInfo.GetSystemTimeZones();
StringBuilder sb = new StringBuilder();

foreach (TimeZoneInfo tzi in tz)
{
    sb.AppendLine(tzi.DisplayName + " " + tzi.BaseUtcOffset + " " + tzi.StandardName + " " + tzi.DaylightName + " " + tzi.SupportsDaylightSavingTime);
}

string codes = sb.ToString();
// do what you want with the output, e.g. save it to a file

This method is used to bind all timezones in Dev express Drop Down.

C#
private void FillTimeZone(ASPxComboBox ddlTimeZone)
{   
   ddlTimeZone.DataSource = TimeZoneInfo.GetSystemTimeZones();   
   ddlTimeZone.DataBind();  
   ListEditItem oListEditItem=new ListEditItem();   
   oListEditItem.Text=Helper.SELECT;   
   oListEditItem.Value=Helper.SELECT;   
   ddlTimeZone.Items.Add(oListEditItem);   
   ddlTimeZone.SelectedIndex = 0;
}

If you want to return a JSON output from a WebAPI call:

C#
using System;
using System.Collections.Generic;

namespace MyProject.ViewModels
{
    public class TimeZoneViewModel
    {
        public readonly List<CTimeZone> CTimeZones;

        public TimeZoneViewModel()
        {
            CTimeZones = new List<CTimeZone>();
            foreach (TimeZoneInfo z in TimeZoneInfo.GetSystemTimeZones())
            {
                var tz = new CTimeZone(z.Id, z.DisplayName, z.BaseUtcOffset);
                CTimeZones.Add(tz);
            }
        }

    }

    public class CTimeZone
    {
        public string Id { get; set; }
        public string DisplayName { get; set; }
        public TimeSpan BaseUtcOffset { get; set; }

        public CTimeZone(string id, string displayName, TimeSpan utcOffset)
        {
            Id = id;
            DisplayName = displayName;
            BaseUtcOffset = utcOffset;
        }
    }
}

Then use it in WebAPI:

C#
[HttpGet("Api/TimeZones")]
public JsonResult GetTimeZones()
{
    return Json(new TimeZoneViewModel().CTimeZones);
}

Output:

json
[{
    "id": "Dateline Standard Time",
    "displayName": "(UTC-12:00) International Date Line West",
    "baseUtcOffset": "-12:00:00"
  },
  {
    "id": "UTC-11",
    "displayName": "(UTC-11:00) Coordinated Universal Time-11",
    "baseUtcOffset": "-11:00:00"
  },
  {
    "id": "Aleutian Standard Time",
    "displayName": "(UTC-10:00) Aleutian Islands",
    "baseUtcOffset": "-10:00:00"
  },
  {
    "id": "Hawaiian Standard Time",
    "displayName": "(UTC-10:00) Hawaii",
    "baseUtcOffset": "-10:00:00"
  },...
Was this article helpful to you?
 

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

There are no comments yet. Why not get the discussion started?

We respect your privacy, and will not make your email public. Learn how your comment data is processed.