Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select only United State Time Zones

Tags:

timezone

c#

Is there an easy way to create a list of only the time zones in US? I am using this code but it produces every time zone and I only want Pacific, Central, Mountain, and Eastern

public List<TimeZoneInfo> _timeZones = TimeZoneInfo.GetSystemTimeZones().ToList();
like image 904
caradrye Avatar asked Mar 30 '12 20:03

caradrye


People also ask

What are the 6 US timezones?

The United States is divided into six time zones: Hawaii-Aleutian time, Alaska time, Pacific time, Mountain time, Central time and Eastern time.

What are the 4 main time zones in the US?

Finally, the railway managers agreed to use four time zones for the continental United States: Eastern, Central, Mountain, and Pacific. Local times would no longer be used by the railroads.

What are the 3 time zones in the US?

There are actually six time zones in the USA. The four main ones are Eastern, Central, Mountain, and Pacific Standard Time.

What are the 7 times zones?

From east to west they are Atlantic Standard Time (AST), Eastern Standard Time (EST), Central Standard Time (CST), Mountain Standard Time (MST), Pacific Standard Time (PST), Alaskan Standard Time (AKST), Hawaii-Aleutian Standard Time (HST), Samoa standard time (UTC-11) and Chamorro Standard Time (UTC+10).


2 Answers

I created a list of US time zones:

   var zones = new List<TimeZoneInfo> {
    TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("US Eastern Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("US Mountain Standard Time"),            
    TimeZoneInfo.FindSystemTimeZoneById("Hawaiian Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"),
};
like image 190
Vasil Galinovsky Avatar answered Oct 01 '22 16:10

Vasil Galinovsky


I think this is an updated list of US timezones:

var timezones = new List<TimeZoneInfo> {
    TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Mountain Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("US Eastern Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("US Mountain Standard Time"),            
    TimeZoneInfo.FindSystemTimeZoneById("Hawaiian Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"),
    TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time (Mexico)"),
    TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time (Mexico)"),
    TimeZoneInfo.FindSystemTimeZoneById("UTC")
};
like image 23
Aziz Avatar answered Oct 01 '22 15:10

Aziz