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

[Fmt-Da] RFE: DateFormat is not sensitive to Windows locale setting

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.3.1, 1.4.2
    • core-libs
    • Fix Understood
    • x86
    • windows_2000, windows_xp

      Name: gm110360 Date: 10/12/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      java version "1.4.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
      Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)

      Opened Regional Options on Windows 2000 and changed Date format to 'yyyy-MM-dd'
      and pressed apply (using locale Norwegian(Bokmål), but same problem with English
      (US)).

      Run this program:
      import java.text.DateFormat;
      import java.text.SimpleDateFormat;

      public class DisplayDateFormat
      {
         public static void main(String args[])
         {
            SimpleDateFormat dateFormat;

            dateFormat=((SimpleDateFormat)DateFormat.getDateInstance
      (DateFormat.SHORT));
            System.out.println("Date format: "+dateFormat.toPattern());
         }
      }

      The output is:
      Date format: dd.MM.yy

      The expected output is
      Date format: yyyy-MM-dd

      Looks like DateFormat.getInstance() doesn't use the values specified in the
      Regional Options on Windows 2000. I think this works on Windows NT4 (can't
      remember this problem there).

      Tryed the same with JRE 1.4 Beta 2 and got the same result.
      (Review ID: 133645)
      ======================================================================

            naoto Naoto Sato
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: