tags:

views:

115

answers:

2

Hi,

The Now() function in VB.NET returns date and time which is different from the system time that I see on the right-bottom on the notification bar. It is 15 hours slower than the system time. Has anyone ever met this problem? I'm using .NET 2.0. Thank you.

+1  A: 

Is that the difference between UCT (Greenwich Mean Time) and your local time? You can use Date.UtcNow() to get the current UTC, and DateNow() should get the local time. Check the time zone settings of your computer.

xpda
+2  A: 

.NET latches the active time zone the very first time you retrieve the time. It does this to prevent code that depends on a steadily increasing value for DateTime.Now from getting a heart-attack. Updating the latched value requires calling System.Globalization.CultureInfo.ClearCachedData() and System.TimeZoneInfo.ClearCachedData().

Hans Passant