On my development box I was facing a weird problem of java (1.4.2_04) Timezone not being what it should be. The good part is that this is not happening on the client box. So all this was ok as the only place it was getting used was in the log4j logs I was just offsetting the time to my time in my head
(Too lazy I know). But recently we were adding some code that was dependent on the timezone in that the time was the content of a mail sent to users and not everybody was prepared for my “mental offset” solution.
Googling for an answer I found this link http://minaret.biz/tips/timezone.html which describes the exact problem I had and a solution that works for me (export TZ=). I basically stuck this export TZ="whatever" to my bash profile.
Upgrading the java version to 1.5.0_02 doesn’t make a difference either and the Linux time zone is also set perfectly and the date command works as it should.
One thing I would like to add is that use the complete name “America/Los_Angeles” and not an ID like PST or JST. Setting the ID works for Java but the date command doesn’t get it, so if you have native apps then they would start acting up because of this.
Oh yeah, if I ever find out what the problem is to begin with, it will be posted here too
for now this fix will have to make do.
Update: Check your /etc/localtime