如何设置缺省时区在ASP.Net应用 [英] How to set default time zone in ASP.Net Application
问题描述
您好,我已经创建了asp.net web应用程序,而不考虑的时区。我使用直接DateTime.Now功能。其实,返回服务器配置的时区格式的日期时间。现在,我不能改变整个应用程序。那么,有没有办法设置在其中托管应用程序的独立服务器的时区?或者有没有办法在网络配置文件进行设置。
Hi i have created the asp.net web application without considering the time zone. I am using directly the DateTime.Now function. Actually that returns datetime in server configured time zone format. Now i cant change entire application. so is there any way set the TimeZone of application independent of server in which it is hosted? or is there any way to set in web config file.
推荐答案
TimeZone.CurrentTimeZone
用于计算机上的时区,其中code正在执行。
检查这些链接: http://msdn.microsoft.com/en -us /库/ system.timezone.currenttimezone.aspx
TimeZone.CurrentTimeZone
is used for the time zone on the computer where the code is executing.
Check these links: http://msdn.microsoft.com/en-us/library/system.timezone.currenttimezone.aspx
http://msdn.microsoft.com/en-美国/库/ system.timezoneinfo.local.aspx
这篇关于如何设置缺省时区在ASP.Net应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!