TimeZone plays an important role for time crucial applications. In that case, you must have to set a proper timezone for the running operating system. One of our users asked about setting up the Timezone in Azure App Services.

In this tutorial, you will learn how to set the Timezone for an application running on Azure App Services. All the screenshots of this tutorial are made for Windows-based Azure App Service.

Identify the OS

You can easily set the Timezone to Windows app service using environment variables but the settings are different for an app service hosted in Linux or Windows.

To identify the OS type, follow:

  1. Log in to the Azure Portal
  2. Open the Azure app service
  3. Go to Console
  4. On the console Window you will either get a Windows prompt or a Linux shell.

Find The TimeZone

The Windows and Linux platforms followed some different string formats for different-2 Timezones. So first you need to find the correct string for the required timezone based on the Azure App Service OS type: To find the string follow:

  • Windows based App Service – Open a PowerShell terminal on a Windows system and run the following command. It will list the Timezone.
    Get-ChildItem -Path 'HKLM:SOFTWAREMicrosoftWindows NTCurrentVersionTime Zones' | Select-Object PSChildName
    
  • Linux based App Service – Visit https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
How to Change TimeZone in Azure App Service Azure Azure App Service Timezone
List of Timezone for Windows Environment

Change TimeZone on Azure App Service

Now, go through the following steps and configure the application setting with the correct name and value.

  1. Log in to the Azure Portal
  2. Open Azure App Service
  3. On the left-hand sidebar click on Configuration under Settings.
  4. Click on “ New Application Setting”
  5. Set the environment variables based on OS type:
    • For Windows App Service type Name and Value as:


      Name=WEBSITE_TIME_ZONE


      Value=Eastern Standard Time
    • For Linux App Service type Name and Value as:


      Name=TZ


      Value=America/New_York
  6. Click Ok
  7. Click Save to confirm and save the change.
How to Change TimeZone in Azure App Service Azure Azure App Service Timezone
Setting Up Timezone of a Azure App Service

That’s it. You have changed the Timezone of the Windows Azure App Service successfully.

Verify TimeZone

Now, make sure that the timezone is applied correctly to the Azure app service. Open the app console and check the current date and time of the service. Match the current date and time with the actual time of the configured Timezone.

How to Change TimeZone in Azure App Service Azure Azure App Service Timezone
Check Current Date and Time in Azure App Service

Conclusion

In this tutorial, You have learned to configure the Timezone of a running App Service on the Azure cloud platform.