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

DateFormat MEDIUM/SMALL for Danish locale is wrong

XMLWordPrintable

    • b39
    • x86
    • windows_xp
    • Verified



      Name: mt103760 Date: 04/03/2003


      FULL PRODUCT VERSION :
      java version "1.4.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
      Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

      FULL OPERATING SYSTEM VERSION : Windows XP Professional


      A DESCRIPTION OF THE PROBLEM :
      The Locale for Denmark is wrong.

      The locale for Denmark outputs 17-02-2001 or 17-02-01, resp.
      for DateFormat.MEDIUM and DateFormat.SMALL.

      This is wrong. It is also in conflict with the international
      standard for dates (see http://www.cl.cam.ac.uk/~mgk25/iso-time.html).

      The Danish Stardard is, basically, the same as the international
      standard (yyyy-mm-dd), but the traditional national format is
      different:

      The short and classic Danish short date format is 17/2-2001 or
      17/2-01. The format 17.02.2001 can also be used, however.

      This is according to the Danish official language dictionary
      (Retsskrivningsordbogen) 2. ed. 1996, page 654f.

      I can send you a copy by fax if you want.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the code included below

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      MEDIUM dd/mm-yyyy
      SMALL dd/mm-yy
      (see above)

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      class DateBug
      {
        public static void main(String[] args) {
          Locale dk = new Locale("da", "DK");
          DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, dk);
          System.out.println(df.format(new Date()));
          // format is dd-mm-yyyy
          // it should be dd/mm-yyyy
          // the first format conflicts with international date standard
          // same problem with DateFormat.SMALL
        }
      }

      ---------- END SOURCE ----------
      (Review ID: 179388)
      ======================================================================

      Verified with Tiger b41, it now returns the date value in the following format:
      "yyyy-MM-dd", // medium date pattern
      "yy-MM-dd", // short date pattern

      ###@###.### 2004-03-09

            kcolfersunw Kieran Colfer (Inactive)
            mtiensunw Minchi Tien (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: