So for example, in the more standard zoneinfo/tzdb time zone database, I use the 'Europe/London' time zone, which alternates between UTC and UTC+1. – Jon Skeet Oct 31 '12 at 20:34 I think he means that the region changes between MST and MDT (both distinct time zones), and not that a programmer needs to change between time zones for that locale. Mountain Daylight Time - is abbreviated as MDT: UTC - GMT Offset: New Mexico is GMT/UTC - 7h during Standard Time New Mexico is GMT/UTC - 6h during Daylight Saving Time: Daylight Saving Time Usage: New Mexico does utilize Daylight Saving Time. Daylight Saving Start Date: New Mexico starts Daylight Saving Time on Sunday March 14, 2021 at 2:00 AM. To follow your function through to conclusion and convert UTC time to Mountain Time manually (either Mountain Standard Time or Mountain Daylight Time depending on the time of year), you would have to extend your function to handle daylight savings. MST to UTC converter to convert between MST (Mountain Standard Time) and UTC (Coordinated Universal Time). Convert any MST time to UTC quickly and accurately. Universal Time and Mountain Standard Time Converter Calculator, UTC and MST Conversion Table.
This Time Zone Calculator converts between different time zones. To determine time zones for various locations, use this page as a reference.
What is Time Zone
A time zone is a region on Earth that uses a uniform time. They are often based on boundaries of countries or lines of longitude. Greenwich Mean Time (GMT) is the mean solar time at the Royal Observatory located in Greenwich, London, considered to be located at a longitude of zero degrees. Although GMT and Coordinated Universal Time (UTC) essentially reflect the same time, GMT is a time zone, while UTC is a time standard that is used as a basis for civil time and time zones worldwide. Although GMT used to be a time standard, it is now mainly used as the time zone for certain countries in Africa and Western Europe. UTC, which is based on highly precise atomic clocks and the Earth's rotation, is the new standard of today.
UTC is not dependent on daylight saving time (DST), though some countries switch between time zones during their DST period, such as the United Kingdom using British Summer Time in the summer months.
Most time zones that are on land are offset from UTC. UTC breaks time into days, hours, minutes, and seconds, where days are usually defined in terms of the Gregorian calendar. Generally, time zones are defined as + or - an integer number of hours in relation to UTC; for example, UTC-05:00, UTC+08:00, and so on. UTC offset can range from UTC-12:00 to UTC+14:00. Most commonly, UTC is offset by an hour, but in some cases, the offset can be a half-hour or quarter-hour, such as in the case of UTC+06:30 and UTC+12:45.
World Time Zone Map
Time zones throughout the world vary, and used to vary even more than they currently do. It wasn't until 1929 before most countries adopted hourly time zones Nepal, the final holdout, did not adopt a standard offset of UTC until 1956, and even then, has a less common offset of UTC+5:45.
Generally, a time change of 1 hour is required with each 15° change of longitude, but this does not necessarily always happen. For example, China and India only use a single time zone even though they are countries that encompass far larger an area than 15° of longitude. Russia on the other hand, is divided into 11 time zones, though at one point this was reduced to 9 time zones. As can be seen, although there is a general standard throughout the world for defining time zones, it is still highly dependent on the country, and is subject to change.
The following map displays the standard time zones across the world. Click the map to enlarge it.
U.S. Time Zone Map
Many countries have more than one time zone. As a general rule of thumb, a change of 15° of longitude should result in a time difference of 1 hour.
In the U.S., there are a total of 9 time zones used. Likely the most well known include Eastern, Central, Mountain, and Pacific Time Zones. These time zones encompass most of the contiguous United States.
- Eastern Time Zone (ET): UTC-05:00 – includes 22 states in the eastern part of the contiguous United States, including some parts of Canada, Mexico, Panama, and the Caribbean islands.
- Central Time Zone (CT): UTC-06:00 – includes parts of Canada, the U.S., Mexico, Central America, some of the Caribbean islands, and parts of the Eastern Pacific Ocean. Only 9 states are fully within the Central Time Zone. Eleven are shared with either the Mountain Time Zones or the Eastern Time zones.
- Mountain Time Zone (MT): UTC-07:00 – includes parts of Canada, Mexico, and the U.S. 5 states are fully within the MT, Ten are shared with either the Pacific Time Zone or the Central Time Zone.
- Pacific Time Zone (PT): UTC-08:00 – includes parts of Canada, the western U.S., and western Mexico. California and Washington are fully within PT. Three states are split between the Pacific Time Zone and the Mountain Time Zone, and Alaska is split between the Pacific Time Zone and Alaska Time Zone.
Atlantic, Alaska, Hawaii-Aleutian, Samoa, and Chamorro Time Zones cover the rest of the United States including Alaska, Hawaii, and the other U.S. territories.
All of these time zones have standard time zones that are offset from UTC from UTC-04:00 through UTC+10:00, though some additionally observe daylight saving time (DST). During DST, the regions that observe DST are offset one hour closer to UTC. The regions that don't observe DST include those in the Atlantic, Samoa, and Chamorro Time Zones.
Daylight Saving Time
Many countries or regions, especially those in Europe and North America practice daylight saving time (DST), sometimes referred to as 'summer time,' with the intent of saving energy. This typically involves advancing the time on a clock by one hour in early spring, and 'rolling back' the time in autumn. Manipulating the time as the seasons change can better synchronize working hours with sunrise and sunset times in certain areas. This is less relevant for higher altitude areas (where sunrise and sunset times are significantly offset with regular working hours regardless of time manipulation) as well as locations near the equator (since there is small variation in daylight throughout the year).
* This Time Zone Calculator does not consider Daylight Saving Time in its calculations.-->
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 to a customer in eastern Asia. This topic explains how to convert times from one time zone to another, as well as how to convert DateTimeOffset values that have limited time zone awareness.
Converting to Coordinated Universal Time
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 time is recommended when a date and time's portability across computers is important. (For details and other best practices using dates and times, see Coding best practices using DateTime in the .NET Framework.) Converting individual time zones to UTC makes time comparisons easy.
You can also serialize a DateTimeOffset structure to unambiguously represent a single point in time. Because DateTimeOffset objects store a date and time value along with its offset from UTC, they always represent a particular point in time in relationship to UTC.
The easiest way to convert a time to UTC is to call the
Shared in Visual Basic) TimeZoneInfo.ConvertTimeToUtc(DateTime) method. The exact conversion performed by the method depends on the value of the
dateTime parameter's Kind property, as the following table shows.
|Converts local time to UTC.|
|Assumes the |
|Returns the |
The following code converts the current local time to UTC and displays the result to the console.
If the date and time value does 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. (For details on retrieving a TimeZoneInfo object that represents the destination time zone, see Finding the time zones defined on a local system.) The following code uses the TimeZoneInfo.ConvertTimeToUtc method to convert Eastern Standard Time to UTC.
Note that this method throws an ArgumentException if the DateTime object's Kind property and the time zone are mismatched. A mismatch occurs if the Kind property is DateTimeKind.Local but the TimeZoneInfo object does not represent the local time zone, or if the Kind property is DateTimeKind.Utc but the TimeZoneInfo object does not equal TimeZoneInfo.Utc.
All of these methods take DateTime values as parameters and return a DateTime value. For DateTimeOffset values, the DateTimeOffset structure has a ToUniversalTime instance method that converts the date and time of the current instance to UTC. The following example calls the ToUniversalTime method to convert a local time and several other times to Coordinated Universal Time (UTC).
Converting UTC to a designated time zone
To convert UTC to local time, see the 'Converting UTC to Local Time' section that follows. To convert UTC to the time in any time zone that you designate, call the ConvertTimeFromUtc method. The method takes two parameters:
The UTC to convert. This must be a DateTime value whose Kind property is set to
The time zone to convert the UTC to.
The following code converts UTC to Central Standard Time.
Converting UTC to local time
To convert UTC to local time, call the ToLocalTime method of the DateTime object whose time you want to convert. The exact behavior of the method depends on the value of the object's Kind property, as the following table shows.
|Returns the DateTime value unchanged.|
|Assumes that the DateTime value is UTC and converts the UTC to local time.|
|Converts the DateTime value to local time.|
The TimeZone.ToLocalTime method behaves identically to the
DateTime.ToLocalTime method. It takes a single parameter, which is the date and time value to convert.
You can also convert the time in any designated time zone to local time by using the
Shared in Visual Basic) TimeZoneInfo.ConvertTime method. This technique is discussed in the next section.
Converting between any two time zones
You can convert between any two time zones by using either of the following two
Shared in Visual Basic) methods of the TimeZoneInfo class:
Acronis true image 2021 full version. This method's parameters are the date and time value to convert, a
TimeZoneInfoobject that represents the time zone of the date and time value, and a
TimeZoneInfoobject that represents the time zone to convert the date and time value to.
This method's parameters are the date and time value to convert, the identifier of the date and time value's time zone, and the identifier of the time zone to convert the date and time value to.
Both methods require that the Kind property of the date and time value to convert and the TimeZoneInfo object or time zone identifier that represents its time zone correspond to one another. Otherwise, an ArgumentException is thrown. For example, if the
Kind property of the date and time value is
DateTimeKind.Local, an exception is thrown if the
TimeZoneInfo object passed as a parameter to the method is not equal to
TimeZoneInfo.Local. An exception is also thrown if the identifier passed as a parameter to the method is not equal to
The following example uses the ConvertTime method to convert from Hawaiian Standard Time to local time.
Converting DateTimeOffset values
Date and time values represented by DateTimeOffset objects are not fully time-zone aware because the object is disassociated from its time zone at the time it is instantiated. However, in many cases an application simply needs to convert a date and time based on two different offsets from UTC rather than on the time in particular time zones. To perform this conversion, you can call the current instance's ToOffset method. The method's single parameter is the offset of the new date and time value that the method is to return.
For example, if the date and time of a user request for a Web page is known and is serialized as a string in the format MM/dd/yyyy hh:mm:ss zzzz, the following
ReturnTimeOnServer method converts this date and time value to the date and time on the Web server.
If the method is passed the string '9/1/2007 5:32:07 -05:00', which represents the date and time in a time zone five hours earlier than UTC, it returns 9/1/2007 3:32:07 AM -07:00 for a server located in the U.S. Pacific Standard Time zone.
The TimeZoneInfo class also includes an overload of the TimeZoneInfo.ConvertTime(DateTimeOffset, TimeZoneInfo) method that performs time zone conversions with ToOffset(TimeSpan) values. The method's parameters are a DateTimeOffset value and a reference to the time zone to which the time is to be converted. The method call returns a DateTimeOffset value. For example, the
ReturnTimeOnServer method in the previous example could be rewritten as follows to call the ConvertTime(DateTimeOffset, TimeZoneInfo) method.