Working with Time Zones in the Admin Interface of Azure-hosted Kentico Projects

   —   

This article discusses the different time zone settings in Kentico, and how they are affected in an Azure environment.

For those who are working with Kentico projects that are hosted in Azure, you may have noticed that the date and time fields in the Admin interface are not logging your correct, local values. Your machine settings and the settings you’ve configured in your Kentico application seem to not make any difference.

For example, I work in Eastern Standard Time (UTC-05:00). I logged into my Azure-hosted Kentico website at 8:55 AM. However, my Event Log says I logged in at 12:55 PM.

AzureTimeEventLog.PNG

That’s not right. The first thing you may want to try is going in to the Settings application, and configuring your time zones. However, even if you set the Server time zone and Site time zone fields to the necessary values, your project will still not correctly log your date and time. I set my time zone settings to the following:

TimeZoneSettings.PNG

I logged back into my project at 10:32 AM. But still my Event Log says I logged in at 2:32 PM.

I tried changing the Server time zone to UTC-05:00, but there was still no effect. It’s the same story if I change my User settings in the Users application.

UserTimeZone.png

The end result is that no out-of-the-box setting in Kentico will change the output of Date and Time values in the Admin interface. You could write custom code that changes the output of Data and Time values, but there is an easier solution!

  1. In the Azure Portal, click on your App Service that contains your Kentico site.
  2. Navigate to the Application settings, and then scroll down to the section that is also named “Application settings”. (See the following image for reference.)
    ApplicationSettings.PNG
  3. Click Add new setting.
  4. Enter the name as “WEBSITE_TIME_ZONE”. Enter the value as your time zone’s full name. (ex. “Eastern Standard Time”) If you’re not sure what the full name of your time zone is, you can find it listed in this following TXT file: Timezones.txt
  5. Click Save, and allow Azure to make the changes to your site.

Now when I log back into my Kentico website, and check the event log, it displays the correct, local time of when I logged in.

Share this article on   LinkedIn Google+

Keith Hammond

Hello! I'm looking for ideas for writing articles about using Kentico.