hotcakedev
hotcakedev

Reputation: 2504

Calendar event in MS Graph API can't set timezone Mountain Standard Time

I am trying to build a select element and add several timezones in United States.

Able to find EST, CST, PST timezones in us & canada, but was not able to find MST(Mountain Standard Time, UTC-7).

Regarding the official document, it says that the timeZone property can be set to any of the time zones currently supported by Windows.

If I have a look at the date/time setting on windows 10, I can see the MST timezone option.

enter image description here

And also if I check this document, it has not MST timezone as well.

Should I just use Mountain Standard Time although it is not in the documents?

Upvotes: 1

Views: 1638

Answers (1)

Matt Johnson-Pint
Matt Johnson-Pint

Reputation: 241563

Generally speaking, most operations in the Microsoft Graph API that work with time zones will accept any valid Windows or IANA time zone identifier.

If you like, you can call the supportedTimeZones API, to get a complete list of those that are available on the server at any time. This might be useful in such cases where a new time zone is established but not yet installed, but in most cases you can just use any of the standard lists.

  • A list of Windows time zone identifiers and their display names can be obtained by calling tzutil /l from a Windows command prompt. You can also do this from .NET using TimeZoneInfo.GetSystemTimeZones (using the Id and DisplayName properties).

  • A list of IANA time zone identifiers can be found on Wikipedia, or from a variety of other sources.

Assuming you want to build a list of time zones for the United States only (not including US Territories), you will need at minimum the following:

Using Windows IDs:

Id                             Windows Display Name (English)
----------------------------------------------------------------------------
"Eastern Standard Time"        "(UTC-05:00) Eastern Time (US & Canada)"
"Central Standard Time"        "(UTC-06:00) Central Time (US & Canada)"
"Mountain Standard Time"       "(UTC-07:00) Mountain Time (US & Canada)"
"US Mountain Standard Time"    "(UTC-07:00) Arizona"
"Pacific Standard Time"        "(UTC-08:00) Pacific Time (US & Canada)"
"Alaskan Standard Time"        "(UTC-09:00) Alaska"
"Aleutian Standard Time"       "(UTC-10:00) Aleutian Islands"
"Hawaiian Standard Time"       "(UTC-10:00) Hawaii"

Using IANA IDs:

"America/New_York"
"America/Chicago"
"America/Denver"
"America/Phoenix"
"America/Los_Angeles"
"America/Anchorage"
"America/Adak"
"Pacific/Honolulu"

With regard to the documentation you referred to in your question:

  • The list of IANA identifiers in the Graph API doc is incomplete, and IMHO that doc needs to be re-written.

  • The list of Windows identifiers in this doc is intentionally incomplete, as it isn't a list of every supported time zone but rather a list of the default time zone by region on a new Windows installation.

Upvotes: 1

Related Questions