如何更改 azure 网站服务中的默认时区? [英] How to change default time zone in azure website service?

查看:28
本文介绍了如何更改 azure 网站服务中的默认时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Azure 网站服务的新手.我上传了我的网站文件,效果很好.

I'm new to Azure Web Sites service. I uploaded my web site files and it works very nice.

但我对默认时区有疑问.我的位置是首尔(+9).但是当我在下面调用时,代码会返回 UTC(+0) 时间.

But I have a problem with default time zone. My location is Seoul(+9). But the code return UTC(+0) time when I call below.

DateTime.Now;

有没有什么方法可以解决这个问题而不需要像编辑 Web.config 这样的复杂修复?

Is there any way to solve this problem without complicated fix like editing Web.config?

推荐答案

现在可以更改 Azure 网站/Web 应用程序的服务器时区.

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

为此,请添加一个名为WEBSITE_TIME_ZONE"的应用程序设置(使用门户),该设置等于相关时区的名称(基本上与 HKLMSoftwareMicrosoftWindows NtCurrentVersion 中的键名相同的字符串时区).

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 HKLMSoftwareMicrosoftWindows NtCurrentVersionTime Zones).

时区值列表是 这里.使用标有时区名称"的列中的值.

The list of time zone values is here. Use a value from the column labeled "Name of Time Zone".

这篇关于如何更改 azure 网站服务中的默认时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆