How to: Change timezone on Azure Website

If you want to go directly to the solution: Click [here](Go-to-solution)

One of my biggest mistakes in the past was the Datetime value in SQL. Seriously.

In all my code when i want to create a registry in the database, one of my practices is using the created_at, because who knows! Maybe in the future will be neccessary.

But, in my curiosity checked in which hour are more often the registrations and it was very strange to see hours like “1 AM” or “3:30 PM” because well, or everybody are sleeping or working.

So, let’s go to basic!

Facing the problem

It is time to do the research 🔍.

  • The first suspect – SQL

I use Azure SQL databases because it’s more familiar for me -and i’m to lazy to use another one- but it is really cool to use Entity Framework with Microsoft SQL out-of-the-box, maybe this is the main reason.

Yeah i know, there are many ways to check the server hour in sql, but i like this one, it’s very simple.


The result? It’s different, then, maybe this is the culprit, but one of my teachers in the past told me:

“If it’s too easy is because or it was or you are doing it wrong.”

I need one more suspect before finish my research.

  • The second suspect – Entity Framework

My favorite ORM, maybe it’s not the best but it is always there, like a buddy.
In local, i run SQL Server Profiler to check the final query for insert into the database… and notice something strange.

The final code includes the datetime already in the insert query. Aha! I know it was not that easy. I need to go even further back.

  • The final suspect – Server

How can i check the date in the server if i was using an App Service? It was my first thought.

Checking out the options in the azure app’s panel, i look that there is a console option(under Development Tools), when i clicked on it, it was an Powershell!

I’m not expert, but there is 2 useful commands to check it out what is going on, date and time, and the second one was the answer of all of this.

The solution 🧙‍♂️

"If you didn’t read all the above, we are right now in the app panel on Azure"

Finally, it’s time to fix this.

Under settings, click on Application Settings.

There are 4 different configuration things, you need to go to Application Configuration section and add a new setting “WEBSITE_TIME_ZONE”.

In value, you need to find your timezone and add the value, for me, it was Central Standard Time.

Click on save, wait for the finish and you are done!

Today we learn:

  • How-to know the date and the time using SQL Server
  • Azure App Services have a hidden console
  • How-to change the timezone of an azure app service

Are you in trouble? Have any questions? Contact me

dmcory @dmcory

I am a mexican Back-End Developer with 6 years of experience and 3 year of MSSQL Database Administrator. Experienced with all stages of the development cycle for web apps. Strong experience in project management and leadership.

Recent Posts

Fired IT guy deletes 23 AWS servers from his old company

A person from the systems area has been imprisoned after being fired for having bad performance, but how can he/she…

1 year ago

Thousands of Asus PCs infected with malware using their app for updates

The hackers sneaked in a back door using the Asus update software, targeting specific computers but affecting thousands of users…

2 years ago

Facebook stored millions of passwords in plaintext

Facebook confirmed thursday in they blog that they stored "hundreds of millions" password in plaintext FOR YEARS

2 years ago

Object-oriented programming: Intro

Today, we are facing what is the most important programming model and why is so popular, click and check it…

2 years ago

How to: Quickly get into Entity Framework

Let's talk a little bit about still using SqlCommand or migrate to Entity Framework, who will win?

2 years ago

How to: Parse JSON using .NET or .NET Core – Objects as values

It's time to another how-to series! This time we will learn about the object as values and how-to read it…

2 years ago

This website uses cookies.