java - LocalDateTime parsing error: DateTimeParseException -


when try parse string "2017-04-06t21:35:00z" localdatetime, exception given below:

java.time.format.datetimeparseexception: text '2017-04-06t21:35:00z' not parsed: unable obtain localdatetime temporalaccessor: {instantseconds=1491514500, microofsecond=0, milliofsecond=0, nanoofsecond=0},iso of type java.time.format.parsed @ java.time.format.datetimeformatter.createerror(datetimeformatter.java:1920) ~[na:1.8.0_91] @ java.time.format.datetimeformatter.parse(datetimeformatter.java:1855) ~[na:1.8.0_91] @ java.time.localdatetime.parse(localdatetime.java:492) ~[na:1.8.0_91] 

and how parse string:

private static datetimeformatter formatter = datetimeformatter.iso_instant; localdatetime time = localdatetime.parse("2017-04-06t21:35:00z", formatter); 

of course can parse string not using iso_instant formatter but, seems can able parse string iso_instant due following documentation:

 * iso instant formatter formats or parses instant in utc,      * such '2011-12-03t10:15:30z'.      * <p>      * returns immutable formatter capable of formatting , parsing      * iso-8601 instant format.      * when formatting, second-of-minute output.      * nano-of-second outputs zero, three, 6 or 9 digits digits necessary.      * when parsing, time @ least seconds field required.      * fractional seconds 0 9 parsed.      * localized decimal style not used. 

it seems me string same of iso_instant format. why wonder code not working.

regards.

first answer here seems you're looking for.

didn't have enough reputation put in comment ...


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -