Recently an odd thing was observed that as the application first starts, the returned date will be just correctly printed as
Thur Dec 06 00:00:00 EST 2012
since we are in EST timezone. Then after a while, after some execution, even without restart the application, the same date would be printed as
Thur Dec 06 05:00:00 UTC 2012
I have been digging down in the application and I don't see any changes that would reset the default timezone of our application. How could that happen? It has been a week since we started working on this and we are still clueless :-(
Also, is there anyway to make sure the application keeps using the system timezone as that would not be changing?
gigi sheh wrote:Also, is there anyway to make sure the application keeps using the system timezone as that would not be changing?
You don't show how the date is actually printed. My guess is you're ultimately relying on Date's toString() method, which does use the system time zone - and that system time zone is changing for some reason. I say, forget the system time zone, get a TimeZone object for whatever time zone you want to use, and use that with a DateFormat to print Dates using that specific time zone.