No. That's not the issue.
It appears that with Java 6 hh parsed zeros, but now it correctly doesn't.
These all parsed in Java 6:
formatter.parse("10/10/2013-0")
formatter.parse("10/10/2013-00")
formatter.parse("10/10/2013-1")
formatter.parse("10/10/2013-12")
but this doesn't:
formatter.parse("10/10/2013-13")
In Java 7 the first two of those don't parse.
-----Original Message-----
From: seajug-***@public.gmane.org [mailto:seajug-***@public.gmane.org] On Behalf Of
Robert Hall
Sent: Monday, November 11, 2013 7:36 PM
To: seajug-***@public.gmane.org
Subject: Re: [seajug] Java 7 breaks SimpleDateFormatter?
I wonder if the issue is not with the 'hh' but the '-'...I've not seen a
date formatted like "10/10/2013-00". But Java 6 parsed it.
R
On 11 November 2013 20:29, Daniel Kirkdorffer <dankirkd-***@public.gmane.org> wrote:
Java 7:
H Hour in day (0-23) Number
<http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#nu
mber> 0
k Hour in day (1-24) Number
<http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#nu
mber> 24
K Hour in am/pm (0-11) Number
<http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#nu
mber> 0
h Hour in am/pm (1-12) Number
<http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#nu
mber> 12
Java 6:
H Hour in day (0-23) Number
<http://jcs.mobile-utopia.com/jcs/78569_SimpleDateFormat.html2#number>
0
k Hour in day (1-24) Number
<http://jcs.mobile-utopia.com/jcs/78569_SimpleDateFormat.html2#number>
24
K Hour in am/pm (0-11) Number
<http://jcs.mobile-utopia.com/jcs/78569_SimpleDateFormat.html2#number>
0
h Hour in am/pm (1-12) Number
<http://jcs.mobile-utopia.com/jcs/78569_SimpleDateFormat.html2#number>
12
I see no change in the Javadoc.
-----Original Message-----
From: seajug-***@public.gmane.org [mailto:seajug-***@public.gmane.org] On Behalf Of
Ron Reynolds
Sent: Monday, November 11, 2013 7:23 PM
To: seajug-***@public.gmane.org
Subject: Re: [seajug] Java 7 breaks SimpleDateFormatter?
i'm certain (as shown below) that the lower-case h worked for 00-23 hours
and now H seems to be required so more accurate to say they tightened up the
rules?
_____
From: Daniel Kirkdorffer <dankirkd-***@public.gmane.org>
To: seajug-***@public.gmane.org
Sent: Monday, November 11, 2013 7:09 PM
Subject: RE: [seajug] Java 7 breaks SimpleDateFormatter?
Doesn't appear so. That would be really bad.
They've added some letters, but none of the ones available in Java 6 have
changed.
Dan
-----Original Message-----
From: seajug-***@public.gmane.org [mailto:seajug-***@public.gmane.org] On Behalf Of
Ron Reynolds
Sent: Monday, November 11, 2013 6:41 PM
To: seajug-***@public.gmane.org
Subject: Re: [seajug] Java 7 breaks SimpleDateFormatter?
it appears they changed the hour rules. changing 'hh' to 'HH' fixed it
(also they seem to have dropped the need to escape the '-'). weird.
On Monday, November 11, 2013 6:31 PM, Ron Reynolds <tequilaron-***@public.gmane.org>
wrote:
I can't believe this so if anyone can point out the error in my ways please
do so.
$ cat Test.java
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
public class Test {
public static void main(String[] args) throws Exception {
SimpleDateFormat formatter = new
SimpleDateFormat("MM/dd/yyyy'-'hh");
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
formatter.setLenient(false);
Date d1 = formatter.parse("10/10/2013-00");
System.out.println(d1);
}
}
$ /usr/java/jdk1.6.0_24/bin/javac Test.java
$ /usr/java/jdk1.6.0_24/bin/java -cp . Test
Wed Oct 09 17:00:00 PDT 2013
$ /usr/java/jdk1.7.0_45/bin/java -cp . Test
Exception in thread "main" java.text.ParseException: Unparseable date:
"10/10/2013-00"
at java.text.DateFormat.parse(DateFormat.java:357)
at Test.main(Test.java:11)
!?!?!?
still hunting for my own hints/answers but in case someone already hit this
please share. :)
--
Robert Hall
robertwadehall-***@public.gmane.org