Yesterday XP automatic Update, prompt, I inadvertently saw an update is about the time zone update, then did not control what, because WinXP Automatic Updates will not bring any harm to the computer, who knows, after a period of time, just my program to get the computer, It was eight hours less than when I showed it on my computer.
So the internet to check, to see who has touched this problem, a check still really someone has encountered this problem, but the solution is no more than every time in the acquisition times, the default time zone to East Eight area, there are several methods:
1, add the following in the System attribute:
System.setproperty ("User.timezone", "Asia/shanghai");
2, change the default time zone to our time zone:
TimeZone TZ = Timezone.gettimezone ("Asia/shanghai");
Timezone.setdefault (TZ);
But all of these methods can only be used in our own applications, when we get time, change the time zone, but for those application servers, they later log something, the time is certainly wrong. So I think there is a third way to restore the computer to the update before, so do not add any code, Java gets the time is correct, just like update before, but my computer turned off the System Restore, and then found some uninstall tools, uninstall the updated update package, but the time zone of the update package is not unloaded.
Later think is not updated after the registry what is different? Open and look,
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones]
Sure enough, and my colleagues did not update the registry on the computer is not the same, it's that node led out is 128KB, my only 72KB, so I import his try, and then open NetBeans, and then print out the time, and finally the system with the same time.