What version (including patch level) of Java are you using?
I noticed on the alldownunder.com Daylight Saving Time page that there was a change for DST in 2008 in Australia. DST will start on the first Sunday in October. In the past, it was apparently the last Sunday in October. We went through a similar change here in the US a year or two ago.
So older versions (i.e. patch levels) of Java will not have the change. You'd have to do some digging through the release notes to see which patches to 1.4.2, 1.5 and 1.6 contain the change.
My curiosity was peeked, so I wrote a quick little program to loop through October. It prints out the GMT time and Sydney time, and the result of TimeZone.inDaylightTime(Date). When I ran the code, I received GMT+11 for the date you had above (22 Oct 2008). (I changed the GMT time to midnight so my tired brain could to the time offset calculation easier ) Notice the DST change occurs as its suppose to on 5 October 2008:
The last date (22 Oct 2008) is the one you showed in your code.
This was run via Java 1.6.0_07. I also ran it against 1.5.0_16 and got the same results. (I didn't run it against a 1.4.2 version, but the latest patch would probably be ok.)
When I ran it against the older Java 1.6.0 and 1.5.0_11, I got very different results:
So those versions are still using the old rule of "last Sunday in October" to calculate when DST starts. Again, you'll need to check the release notes to see at what patch level the new DST rule was introduced for each version.
I hope that helps. [ August 19, 2008: Message edited by: Mark Vedder ]
posted 11 years ago
Thanks Mark for your inputs.
Indeed this was the problem. I noticed that may be I will have to apply a patch to make this DST change to happen in Java.
Normally trees don't drive trucks. Does this tiny ad have a license?