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.
Asked
Active
Viewed 2.1k times
1 Answers
3
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

Srinivas
- 1,063
- 7
- 15
-
1I want to set my web application to (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi format. No where in application i m using TimeZone property before i use DateTime Class. Do i need to change my application code to use TimeZone localZone = TimeZone.CurrentTimeZone before i use DateTime Class? – Pravin Jan 12 '13 at 14:40
-
2Almost same scenario is explained in another link http://stackoverflow.com/questions/8589014/how-to-change-time-zone-for-an-asp-net-application . I think once i need to change code in entire application to use common util class, but then any further changes only need a change in a single place. I think no option to set in web.config for my scenario. – Pravin Jan 28 '13 at 16:07