Duplicate :
|
|
Relates :
|
|
Relates :
|
Name: gsC80088 Date: 02/04/99 new Date() is out by 1 hour because of a DST error. I'm running in Melbourne, Australia. Melbourne has the same DST rules as Sydney, Australia. These are different from those for Brisbane, Australia: Brisbane doesn't have DST; Melbourne and Sydney do. My NT timezone is set to GMT+10 (Australia/Brisbane+Sydney+Melbourne). The following program demonstrates that user.timezone is being set to Australia/Brisbane instead of Australia/Sydney, which means that new Date() is out by 1 hour - it's not DST-adjusted and it should be. This used to work in JDK 1.1 because all of eastern Australia was in AET. This of course was wrong for Brisbane! public class Timezone { public static void main(String[] args) { System.out.println("user.timezone="+System.getProperties().getProperty("user.timezone")); } } Output: user.timezone=Australia/Brisbane As Melbourne and Sydney are the two biggest cities and are in the two most populous states (Victoria and NSW respectively), the JDK 1.1 error was marginally preferable to the JDK 1.2 error. (Review ID: 48539) ======================================================================
|