How to set default time zone in ASP.Net Application

烂漫一生 提交于 2019-12-19 17:40:32

问题


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.


回答1:


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-us/library/system.timezoneinfo.local.aspx



来源:https://stackoverflow.com/questions/14293858/how-to-set-default-time-zone-in-asp-net-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!