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

DateFormat Short, UK not parsing "05/12/2010"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1.6
    • 1.1.3
    • core-libs
    • 1.1.6
    • 1.1.6
    • x86
    • windows_95
    • Verified



        Name: dgC58589 Date: 12/05/97


        I don't know whether it is a bug or not.
        But I want to convert a string of "05/12/2010" to
        date. Kindly help me in this.

        import java.util.*;
        import java.text.*;

        class datetest
        {
          public static void main(String[] args) throws ParseException
          {
                Date aDate;
                String test;
                DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK);
                aDate = fmt.parse("05/12/2010");
                System.out.println("The Date String is : "+fmt.format(aDate));
                System.out.println("The Date String is : "+aDate);
          }
        }


        The output I got is "The Date String is : Mon Jan 05 00:00:00 GMT +00:00 1920

        Other outputs are :
        The Date String is : 05/12/10
        The Date String is : Sun Dec 04 19:00:00 EST 3910


        (Review ID: 21409)
        ======================================================================
        sandy.labrasca@eng 1999-01-12
        see more info...

              bcbeck Brian Beck (Inactive)
              dgrahamcsunw David Graham-cumming (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: