Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6286592
Votes 0
Synopsis (fmt) Formatter "%tz" returns wrong GMT time offset during daylight savings time
Category java:classes_util
Reported Against
Release Fixed 7(b20), 6-open(b02) (Bug ID:2152916)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 6582620 , 6582621 , 6603263
Submit Date 16-JUN-2005
Description
FULL PRODUCT VERSION :
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
default locale: de_AT
time zone: central european time (Berlin, Vienna), daylight saving.

A DESCRIPTION OF THE PROBLEM :
%tz of java.util.Formatter shows a wrong GMT timezone offset.
See example code.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the attached source code.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the GMT timezone offset of "%tz" should be the GMT time zone offset -
like  "Z" of SimpleDateFormat.

SimpleDateFormat: 2005-06-08 12:56:22.177 +0200
format date+time: should be identical

ACTUAL -
SimpleDateFormat: 2005-06-08 12:56:22.177 +0200
format date+time: 2005-06-08 12:56:22.177 +0100
... %tz gives a wrong GMT time offset.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
    Date now = new Date ();
    System.out.println ("SimpleDateFormat: " +
      new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.SSS Z").format (now));
    System.out.format ("format date+time: %tF %<tT.%<tL %<tz%n", now);

---------- END SOURCE ----------
  xxxxx@xxxxx   2005-06-16 11:48:03 GMT
Work Around
N/A
Evaluation
Oops.  It appears that the GMT offset computation incorrectly neglected to adjust for DST.  The specification needs to be updated to indicate this behaviour.

While we're looking at the specification for time zone conversions, I see that we've also neglected to mention where we get time zone data for long and java.util.Date.  This should also be specified.
Posted Date : 2007-07-16 22:10:45.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang