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.
By default, on Azure App Service, the time zone is always UTC, but you can change it.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With