Groups > IBM > WebSphere Studio Application Site Developer > WSAD7 / Java 1.5 reporting the wrong time after Daylight changes.




WSAD7 / Java 1.5 reporting the wrong time after Daylight
changes.

WSAD7 / Java 1.5 reporting the wrong time after Daylight changes.
Sun, 06 Apr 2008 02:07:17 EDT
First, if this is the wrong thread, please direct me the correct one :-)<br
/>
<br />
I work in Tel Aviv, using WSAD7 IBM Java 1.5 and sometimes Sun Java 1.5 Since
the DST change, Java reports the time as 'one hour ahead'. I get the
following;<br />
<br />
Locale.getDefault() --&gt; iw_IL (CORRECT)<br />
new GregorianCalendar().getTime() --&gt; now + 1 hour (WRONG)<br />
new GregorianCalendar().getTimeZone() --&gt; Asia/Jerusalem (CORRECT)<br
/>
new GregorianCalendar().useDaylightTime() --&gt; true (CORRECT)<br />
System.currentTimeMillis() --&gt; now + 1 hour (WRONG)<br />
<br />
I had the same problem in Sun Java 1.5. There is a 'registry fix', if one sets
'DisableAutoDaylightSet=1', Sun Java 1.5 reports ;<br />
<br />
Locale.getDefault() --&gt; iw_IL (CORRECT)<br />
new GregorianCalendar().getTime() --&gt; now! (CORRECT)<br />
new GregorianCalendar().getTimeZone() --&gt; GMT+2 (CORRECT, but not
Asia/Jerusalem!?, I don't use this anyway).<br />
new GregorianCalendar().useDaylightTime() --&gt; false (WRONG, but our PCs
are sync'd with a central server and we don't care if this is true or
false).--&gt; now + 1 hour (WRONG)<br />
System.currentTimeMillis() --&gt; now! (CORRECT)<br />
<br />
This 'fix' does <b>not</b> work for IBM Java 1.5. The timezone
database is correct as it has the correct start-finish times for DST here).
<br />
<br />
Post Reply
about | contact