Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default time zone in ASP.Net Application

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.

like image 314
Pravin Avatar asked Jan 12 '13 13:01

Pravin


1 Answers

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

like image 110
Srinivas Avatar answered Sep 19 '22 05:09

Srinivas