26

We are using azure web app service for multi tenant application. But default time zone of app service is UTC taking i want to change that time zone for that region only.

I have tried WEB_TIMEZONE variable in app setting but not working.

paresh
  • 351
  • 1
  • 3
  • 12

6 Answers6

86

You are setting wrong variable. You need to set WEBSITE_TIME_ZONE variable in Application settings. enter image description here To see supported timezone values see this

To verify that whether offset is updated or not navigate to Console and execute time command enter image description here

Reference: https://kvaes.wordpress.com/2017/01/24/changing-the-timezone-on-your-azure-webapp-app-service-function/

Abdul Rauf
  • 5,798
  • 5
  • 50
  • 70
  • @andrej how are you getting time in your java app? Ensure that particular java method that you are using is reading local time from environment. – Abdul Rauf Mar 20 '19 at 04:28
  • @AbdulRauf my azure appservice is in north europe region and I am getting GMT times. My user is in GMT+1 region and the logs using org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(My.class); LOGGER.debug("Hello, world!"); are in GMT – andrej Mar 20 '19 at 16:25
  • @andrej have you verified using `time` command that whether timezone is updated or not? if its updated and your app is still showing time in UTC than you may need to change settings of your Logger – Abdul Rauf Mar 21 '19 at 06:01
  • 1
    Just got caught out by this. I'd assumed it would by default take the timezone of the region the App Service it was based in (in my case UK West) but obviously not :) – Fetchez la vache Jul 17 '20 at 10:18
  • 2
    WARNING: To reuse the UTC time, you need to set the value to empty then save ! Indeed if you delete the WEBSITE_TIME_ZONE setting parameter and save the config, the previous WEBSITE_TIME_ZONE exists still... If you delete it, you can refresh the config view to see it reappear in the configuration list. – rdhainaut Feb 16 '21 at 23:57
10

You could add an application setting (using the portal) called WEBSITE_TIME_ZONE equal to the name of the time zone (as defined in the Windows Registry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Nt\CurrentVersion\Time Zones\).

for example:

enter image description here

Jay Gong
  • 23,163
  • 2
  • 27
  • 32
9

If your App Service Plan is Linux change you need to set TZ variable in Application settings with your time zone in format like America/Sao_Paulo

Don't forget save and restart App.

Example: example

List of time zones in: https://www.php.net/manual/en/timezones.php

Wlad Neto
  • 351
  • 3
  • 10
2

For Asp Core, you must use the variable name WEBSITE_TIME_ZONE instead of TZ

Example

+-------------------+---------------------------+------------------+
|   Variable name   |          Windows          |      Linux       |
+-------------------+---------------------------+------------------+
| WEBSITE_TIME_ZONE | AUS Eastern Standard Time | Australia/Sydney |
+-------------------+---------------------------+------------------+
Yorro
  • 11,445
  • 4
  • 37
  • 47
1

Just adding to the other answers, you can find the Default Windows Timezones here:

https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones

You need to set the value contained in the column "Timezone".

El Mac
  • 3,256
  • 7
  • 38
  • 58
0

If you're using Linux Consumption set TZ variable in Application settings. Example:

TZ: America/Sao_Paulo
Roger Hayashi
  • 71
  • 1
  • 6