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

DateFormat incorrect for German locale

XMLWordPrintable

    • b12
    • x86
    • windows_xp

        FULL PRODUCT VERSION :
        On windows:
        java version "1.5.0_04"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
        Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)

        On Linux:
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build 1.6.0-b105)
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]
        Linux h114155 2.4.25 #3 SMP Sun Apr 4 19:32:54 CEST 2004 i686 i686 i386 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        The full output of a time with DateFormat is not as expected for a German locale.
        As you can see in the example, there are several problems with it. First, it doesn't add leading zeros and uses a dot instead of a colon for separating hours from minutes. While this is a format that may be used somewhere in Germany, it is not the correct one according to the significant standards.
        Second, the code of the time zone is not translated. According to http://de.wikipedia.org/wiki/Zeitzone#UTC_bis_UTC.2B3 there are five time zones with a German name and acronym:
        - WEZ for WET, the West European Time
        - WESZ for WEST/WEDT, the West European Summer Time/Daylight Time
        - MEZ for CET, the Central European Time
        - MESZ for CEST/CEDT, the Central European Summer Time/Daylight Time
        - OEZ for EET, the East European Time

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile and run the provided source code.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Output at time of execution:
        00:37 Uhr MEZ
        ACTUAL -
        Output at time of execution:
        0.37 Uhr CET

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.text.DateFormat;
        import java.util.Locale;
        import java.util.Date;

        public class DateFormatTest
        {
        public static void main(String[] args)
        {
        Locale l = new Locale("de", "DE");
        DateFormat df = DateFormat.getTimeInstance(DateFormat.FULL, l);
        System.out.println(df.format(new Date()));
        }
        }
        ---------- END SOURCE ----------

              jtusla Jiri Tusla (Inactive)
              okutsu Masayoshi Okutsu
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: