Fix DateTime.Now returning UTC time issue in Azure Web Apps

DateTime.Now returns the time by taking into account server’s time zone on which application is hosted. As Azure web apps has time zone set to UTC even its location is somewhere else say in central US.

When we try to access the server’s time using DateTime.Now, it returns UTC time.

You can fix this issue by adding the following application settings using Azure Portal:
Value: Time zone of the application where it is hosted in Azure say Central Standard Time

You can get the name of time zones from here

It will save you from modifying your code base, you just have to set this key in one place.

Share it