Why both new Date() and Calendar.getInstance give wrong time
807591Mar 11 2008 — edited Mar 11 2008hi, folks:
I get a strange problem. I am trying to get the current time which is showing on the lower right corner of my computer. I tried new Date() and Calendar.getInstance( ). However, either gives me wrong hour, for example, if the current time is Mar 11, 3:20 PM, 2008, US eastern time, either one gives me: Tue Mar 11 14:20:00 EST 2008, which is always one hour behind the current time, but the month, date, year , minute and time zone are correct.
I also tried new Date((System.currentTimeMillis())) but get the same thing
I further tried new GregorianCalendar().get(Calendar.DST_OFFSET), it should give me 3600000 (one hour) but actually it gived me 0
I thought the Java code should automatically catch the daylight saving time but it is not the case.
I install tzupdater.jar and run but nothing change.
anybody has any idea, I appreciate your kind help!