Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / November 2006

Tip: Looking for answers? Try searching our database.

TimeZone.CurrentTimeZone doesn't update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Kane [MVP - Outlook] - 15 Nov 2006 07:27 GMT
I'm seeing TimeZone.CurrentTimeZone accurately reflecting the machine time
zone at the point that the assembly loads, but if the user subsequently
changes the Windows time zone the value of TimeZone.CurrentTimeZone doesn’t
change to reflect that.
In other words, if the system is on PST when my assembly loads then whenever
time I instantiate a TimeZone object
(System.TimeZone tz = System.TimeZone.CurrentTimeZone;)
the value of tz.StandardName returns "Pacific Standard Time" and
tz.GetUtcOffset comes back as -08:00:00 - even if I change to Brisbane time
(+10:00:00)

Is there some trick to this that I'm missing?

I've got an Outlook add-in that's passing date values to a web service. Even
though it works in UTC internally, the SOAP proxy classes expect values in
local time to which the parser then assigns an offset. The conversions to and
from UTC continue to use the original offset even if the user changes time
zones, which corrupts the data.
Ciaran O''Donnell - 16 Nov 2006 10:39 GMT
The cultureinfo is cached when retrieved from windows. Call the following
function to empty the cache. This will cause things like the timezone to be
reloaded:
System.Globalization.CultureInfo.CurrentCulture.ClearCachedData();

Ciaran O'Donnell

> I'm seeing TimeZone.CurrentTimeZone accurately reflecting the machine time
> zone at the point that the assembly loads, but if the user subsequently
[quoted text clipped - 14 lines]
> from UTC continue to use the original offset even if the user changes time
> zones, which corrupts the data.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.