Last post Jan 04, 2008 04:19 AM by rstrahl
Jan 01, 2008 06:48 PM|Saturday3AM|LINK
For example, if I use a web hosting located in the GMT timezone that has GMT time on the server and I want the application to use CET (GMT+1). Is there a way to set what timezone the application should use? Could something like this be done in web.config?
Jan 01, 2008 11:07 PM|ratkinso|LINK
I am unsure of being able to do it in the web.config page, but here is an example of where I have done it in the code-behind:
Jan 04, 2008 02:49 AM|rstrahl|LINK
The server uses the local timezone that the server is set to in Windows. As far as I know there's no way to just change the timezone that your application sees while it's running. All you get is TimeZone.Local and you can calculate offsets between it and
the UTC times.
+++ Rick ---
Jan 04, 2008 03:02 AM|Marco Buerckel|LINK
Well, within .NET 3.5 there's a new class called TimeZoneInfo. With this class you can enumerate installed time zones and convert from one timezone to another easily. Earlier framework versions had a rather poor support for timezones.
Jan 04, 2008 04:19 AM|rstrahl|LINK
Yes that helps, but still doesn't solve the original problem... Getting the current timezone, and UTC and then adding or subtracting an offset has always been pretty straight forward. But actually switching the timezone in the same way that say you can switch
culture is still not possible as far as I can tell...