How to change default time zone in azure website service?

百般思念 提交于 2019-11-30 03:18:47

It is now possible to change the server time zone for your Azure Websites / Web Apps.

To do this, add an application setting (using the portal) called “WEBSITE_TIME_ZONE” equal to the name of the time zone in question (basically the same string as the key name at HKLM\Software\Microsoft\Windows Nt\CurrentVersion\Time Zones\).

Petr Abdulin

Changing TimeZone on Azure VMs is not recommended according to Microsoft. Instead convert time to local using methods of TimeZoneInfo structure.

However at least one possible solution is mentioned in the above mentioned post.

P.S. an example of solution provided by question author in comment below:

DateTime timeUtc = DateTime.UtcNow;
TimeZoneInfo kstZone = TimeZoneInfo.FindSystemTimeZoneById("Korea Standard Time"); 
DateTime kstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, kstZone);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!