Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6286592

(fmt) Formatter "%tz" returns wrong GMT time offset during daylight savings time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 5.0
    • core-libs
    • b20
    • x86
    • windows_xp
    • Verified

        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 :
        Microsoft 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 ----------
        ###@###.### 2005-06-16 11:48:03 GMT

              iris Iris Clark
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: