Created
May 17, 2016 18:31
-
-
Save makuk66/8e145819e265ac2b8aff4a5b2b598768 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Different handling of `hh`: | |
groovy:000> import java.text.SimpleDateFormat | |
===> java.text.SimpleDateFormat | |
groovy:000> parser=new SimpleDateFormat("EEE MMM d hh:mm:ss yyyy Z") | |
===> java.text.SimpleDateFormat@fee3c270 | |
groovy:000> parser.parse("Wed Sep 30 17:14:25 2015 -0700") | |
===> Thu Oct 01 01:14:25 BST 2015 | |
groovy:000> parser2=new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy Z") | |
===> java.text.SimpleDateFormat@87bd4670 | |
groovy:000> parser2.parse("Wed Sep 30 17:14:25 2015 -0700") | |
===> Thu Oct 01 01:14:25 BST 2015 | |
groovy:000> import org.joda.time.format.DateTimeParser | |
===> org.joda.time.format.DateTimeParser | |
groovy:000> import org.joda.time.format.DateTimeFormat | |
===> org.joda.time.format.DateTimeParser, org.joda.time.format.DateTimeFormat | |
groovy:000> jparser=org.joda.time.format.DateTimeFormat.forPattern("EEE MMM d hh:mm:ss yyyy Z") | |
===> org.joda.time.format.DateTimeFormatter@651905c5 | |
groovy:000> jparser.parseDateTime("Wed Sep 30 17:14:25 2015 -0700") | |
ERROR org.joda.time.IllegalFieldValueException: | |
Cannot parse "Wed Sep 30 17:14:25 2015 -0700": Value 17 for clockhourOfHalfday must be in the range [1,12] | |
at org.joda.time.field.FieldUtils.verifyValueBounds (FieldUtils.java:234) | |
at org.joda.time.field.ZeroIsMaxDateTimeField.set (ZeroIsMaxDateTimeField.java:86) | |
at org.joda.time.format.DateTimeParserBucket$SavedField.set (DateTimeParserBucket.java:568) | |
at org.joda.time.format.DateTimeParserBucket.computeMillis (DateTimeParserBucket.java:447) | |
at org.joda.time.format.DateTimeParserBucket.computeMillis (DateTimeParserBucket.java:411) | |
at org.joda.time.format.DateTimeFormatter.parseDateTime (DateTimeFormatter.java:882) | |
at org.joda.time.format.DateTimeFormatter$parseDateTime.call (Unknown Source) | |
groovy:000> jparser2=org.joda.time.format.DateTimeFormat.forPattern("EEE MMM d HH:mm:ss yyyy Z") | |
===> org.joda.time.format.DateTimeFormatter@49c99fc | |
groovy:000> jparser2.parseDateTime("Wed Sep 30 17:14:25 2015 -0700") | |
===> 2015-10-01T01:14:25.000+01:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment