[Azure Function] timezone TZ not working. leading to 500 error. Some TZ like "Australia/Melbourne" working

Dario 0 Reputation points
2023-05-02T16:09:09.9766667+00:00

[Azure Function] Configuration on linux-hosted function for Timezone TZ-values not working. It's leading to 500 error. Some TZ-values like "Australia/Melbourne" working, but most don't. Unable to debug the 500 itself, but it's a strange behaviour that some timezones values are working, and other don't.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,402 questions
Microsoft Configuration Manager
{count} votes

3 answers

Sort by: Most helpful
  1. Luke Murray 11,246 Reputation points MVP
    2023-05-02T20:37:02.8733333+00:00

    Hi, Dario

    When looking at Timezones - try the below:

    Dateline Standard Time

    UTC-11

    Aleutian Standard Time

    Hawaiian Standard Time

    Marquesas Standard Time

    Alaskan Standard Time

    UTC-09

    Pacific Standard Time (Mexico)

    UTC-08

    Pacific Standard Time

    US Mountain Standard Time

    Mountain Standard Time (Mexico)

    Mountain Standard Time

    Yukon Standard Time

    Central America Standard Time

    Central Standard Time

    Easter Island Standard Time

    Central Standard Time (Mexico)

    Canada Central Standard Time

    SA Pacific Standard Time

    Eastern Standard Time (Mexico)

    Eastern Standard Time

    Haiti Standard Time

    Cuba Standard Time

    US Eastern Standard Time

    Turks And Caicos Standard Time

    Paraguay Standard Time

    Atlantic Standard Time

    Venezuela Standard Time

    Central Brazilian Standard Time

    SA Western Standard Time

    Pacific SA Standard Time

    Newfoundland Standard Time

    Tocantins Standard Time

    E. South America Standard Time

    SA Eastern Standard Time

    Argentina Standard Time

    Greenland Standard Time

    Montevideo Standard Time

    Magallanes Standard Time

    Saint Pierre Standard Time

    Bahia Standard Time

    UTC-02

    Mid-Atlantic Standard Time

    Azores Standard Time

    Cape Verde Standard Time

    UTC

    GMT Standard Time

    Greenwich Standard Time

    Sao Tome Standard Time

    Morocco Standard Time

    W. Europe Standard Time

    Central Europe Standard Time

    Romance Standard Time

    Central European Standard Time

    W. Central Africa Standard Time

    GTB Standard Time

    Middle East Standard Time

    Egypt Standard Time

    E. Europe Standard Time

    Syria Standard Time

    West Bank Standard Time

    South Africa Standard Time

    FLE Standard Time

    Israel Standard Time

    South Sudan Standard Time

    Kaliningrad Standard Time

    Sudan Standard Time

    Libya Standard Time

    Namibia Standard Time

    Jordan Standard Time

    Arabic Standard Time

    Turkey Standard Time

    Arab Standard Time

    Belarus Standard Time

    Russian Standard Time

    E. Africa Standard Time

    Volgograd Standard Time

    Iran Standard Time

    Arabian Standard Time

    Astrakhan Standard Time

    Azerbaijan Standard Time

    Russia Time Zone 3

    Mauritius Standard Time

    Saratov Standard Time

    Georgian Standard Time

    Caucasus Standard Time

    Afghanistan Standard Time

    West Asia Standard Time

    Ekaterinburg Standard Time

    Pakistan Standard Time

    Qyzylorda Standard Time

    India Standard Time

    Sri Lanka Standard Time

    Nepal Standard Time

    Central Asia Standard Time

    Bangladesh Standard Time

    Omsk Standard Time

    Myanmar Standard Time

    SE Asia Standard Time

    Altai Standard Time

    W. Mongolia Standard Time

    North Asia Standard Time

    N. Central Asia Standard Time

    Tomsk Standard Time

    China Standard Time

    North Asia East Standard Time

    Singapore Standard Time

    W. Australia Standard Time

    Taipei Standard Time

    Ulaanbaatar Standard Time

    Aus Central W. Standard Time

    Transbaikal Standard Time

    Tokyo Standard Time

    North Korea 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

    Lord Howe Standard Time

    Bougainville Standard Time

    Russia Time Zone 10

    Magadan Standard Time

    Norfolk Standard Time

    Sakhalin Standard Time

    Central Pacific Standard Time

    Russia Time Zone 11

    New Zealand Standard Time

    UTC+12

    Fiji Standard Time

    Kamchatka Standard Time

    Chatham Islands Standard Time

    UTC+13

    Tonga Standard Time

    Samoa Standard Time

    • Line Islands Standard Time

    I used the: Get-TimeZone -List | Select-Object Id cmdlet to get the list, this is usually what I use. Theres a few Australia time zones listed (I am in NZ so 'New Zealand Standard Time' is pretty standard) - try the one that suits your location better, and let us know how you get on.


  2. Dario 0 Reputation points
    2023-05-03T13:28:15.0033333+00:00

    Sadly, those timezones are for windows. I use a linux hosted. my valid timezones (like "Europe/Berlin") are responding to a 500-error. Using invalid values like the windows-timezones or randon string will lead to 200-response or my API with DateTime.Now = UTC-time. The 500 error lead me to think the TZ value itself is valid, but I can't figure out or debug what exactly lead to it.


  3. MuthuKumaranMurugaachari-MSFT 22,401 Reputation points
    2023-05-03T14:33:27.5633333+00:00

    Dario Thanks for posting your question in Microsoft Q&A. For Linux hosted function, you can set WEBSITE_TIME_ZONE application setting for Premium/Dedicated or TZ for Consumption plan to desired time zone as listed here. Here is doc reference: WEBSITE_TIME_ZONE.

    After setting this value (which restarts Azure Functions), you can test by navigating to SSH menu under Development Tools in the azure portal and enter date command which will give the value based on the time zone you have set. I have validated Europe/Berlin time zone in the list and tested in my function app as well.

    SSH:

    User's image

    App Setting:

    User's image

    500 error might not be related to TZ application setting and it would be helpful if you can share code snippet, function runtime, hosting plan, full exception etc. to assist you further. I hope this helps and feel free to add a comment if you have any questions.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.