Results 1 to 3 of 3
  1. #1
    eucaleb is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Java 1.6 versus Java 1.7 non-lenient SimpleDateFormat, Hour in am/pm (1-12)

    There seems to be a difference between Java 1.6 versus Java 1.7 non-lenient SimpleDateFormat for valid "h" - Hour in am/pm (1-12)

    I have this code:

    Java Code:
    java.util.Locale oLocale = new java.util.Locale("en", "US" );
    java.text.DateFormat formatter = java.text.DateFormat.getDateTimeInstance(java.text.DateFormat.LONG, java.text.DateFormat.LONG, oLocale);
    formatter.setLenient(false);
    System.out.println("java.version: "+System.getProperty("java.version"));
    System.out.println(((java.text.SimpleDateFormat)formatter).toPattern());
    try {
      System.out.println(formatter.parse("July 28, 2011 0:20:00 AM EEST"));
    } catch (java.text.ParseException e) {
      e.printStackTrace();
    }

    The output in java 1.6 is:

    java.version: 1.6.0_37
    MMMM d, yyyy h:mm:ss a z
    Thu Jul 28 00:20:00 EEST 2011

    The output in java 1.7 is:

    java.version: 1.7.0_13
    MMMM d, yyyy h:mm:ss a z
    java.text.ParseException: Unparseable date: "July 28, 2011 0:20:00 AM EEST"
    at java.text.DateFormat.parse(Unknown Source)
    at DateTime.main(DateTime.java:10)


    Where might I find if this change or bug fix was documented ?

    Thank you,
    Mihai

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default Re: Java 1.6 versus Java 1.7 non-lenient SimpleDateFormat, Hour in am/pm (1-12)

    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    eucaleb is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Re: Java 1.6 versus Java 1.7 non-lenient SimpleDateFormat, Hour in am/pm (1-12)

    I deleted the other post/thread.
    Last edited by eucaleb; 02-18-2013 at 01:58 PM.

Similar Threads

  1. 24 hour clock to 12 hour clock project.
    By bs3ac in forum New To Java
    Replies: 4
    Last Post: 01-08-2013, 11:10 AM
  2. Java - Constructor Method versus Constructor
    By brocksoffice in forum New To Java
    Replies: 1
    Last Post: 08-01-2012, 10:17 AM
  3. Problem Display Jmenubar Java Se6 u23 versus Java SE6 u22
    By Ravanelly in forum Advanced Java
    Replies: 0
    Last Post: 01-07-2011, 10:36 AM
  4. Java versus VBA
    By waspandbee in forum New To Java
    Replies: 8
    Last Post: 06-14-2010, 01:21 PM
  5. Using SimpleDateFormat
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 07-18-2008, 09:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •