Reputation: 1184
I have deployed a backend microservice in .net core 3 on Azure and am returning a list of datetime values which i have converted to UTC using ToUniversalTime()
method. For some reason the datetimes returned are not converted to UTC and are the same values stored in db. It works well when i run it locally.
Upvotes: 0
Views: 716
Reputation: 22456
By default, Azure Web Apps run in UTC timezone. So for the application, a local time that is read from the database is interpreted to be UTC, hence calling ToUniversalTime does not change the value. You can specify the timezone for the Web App using the WEBSITE_TIME_ZONE setting as described here: https://www.jasongaylord.com/blog/tip-changing-an-azure-app-service-time-zone
Upvotes: 1