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

REGRESSION: SimpleDateFormat not working with Locale

XMLWordPrintable

    • b24
    • x86
    • windows_xp

      Name: rmT116609 Date: 09/02/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
      Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP

      A DESCRIPTION OF THE PROBLEM :
      When using a danish Locale a SimpledateFormat.format should return the date in dd-mm-yy but returns the date in yy-mm-dd

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Locale.setDefault(new Locale("da"));
      SimpleDateFormat sdf = new SimpleDateFormat();
      System.out.println(sdf.format(new Date()));


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      in 1.4.2 it returns
      02-09-04 15:45

      in 5.0 it returns
      04-09-02 15:45
      ACTUAL -
      04-09-02 15:45

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      /
      public class DateTest {

      public static void main(String[] args) {
      Locale.setDefault(new Locale("da"));
      SimpleDateFormat sdf = new SimpleDateFormat();
      System.out.println(sdf.format(new Date()));

      }
      }
      ---------- END SOURCE ----------

      Release Regression From : 1.4.2_04
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 301698)
      ======================================================================
      ###@###.### 10/12/04 08:48 GMT

            jtusla Jiri Tusla (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: