Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DateTime.Now returning different times on local and azure app service

I am from west India. DateTime.Now returning current time when debugging from Visual Studio. But when I hosted it on an Azure App Service, it is returning 6 hours earlier time. The App Service is hosted in West India. I added App Setting for the App Service WEBSITE_TIME_ZONE to Indian Standard Time and restarted the App Service but still the same issue.

like image 579
Aishwarya Shiva Avatar asked Apr 18 '19 12:04

Aishwarya Shiva


People also ask

What is the Azure App Service TimeZone?

By default, on Azure App Service, the time zone is always UTC, but you can change it.

How do I change location of app service in Azure?

App Service resources are region-specific and can't be moved across regions. You must create a copy of your existing App Service resources in the target region, then move your content over to the new app.


1 Answers

Indian Standard Time is not supported as App Service's timezone name, check supported time zone names here (Check exact spelling of the tz name in left-side column).

Best practise is to use UTC time in server context and convert it to local time in UI.

like image 68
Risto M Avatar answered Sep 19 '22 04:09

Risto M