I have a time string, which looks like this: 20170822T194135+00. This is called basic ISO:8601 format, if I understood correctly.
When I try to parse it using ZonedDateTime, it throws exception, complaining that it can't parse it.
SO, how do I convert this string to a valid Joda datetime object?
Do I need to build manual "format" to parse it (this would be silly, considering it's a standard format)?
Desperately, I've actually tried to implement custom format:
const time = ZonedDateTime.parse(timeString, DateTimeFormatter.ofPattern(`yyyyMMdd'T'HHmmssZ`));
But, it throws error on column 15. Looks like it fails to parse the timezone. Is my implementation correct? How do I make it work?
I could do it using the pattern
xas described in the docs (this pattern accepts offsets like+00).Then I parsed directly to a
ZonedDateTime:The resulting
timevariable has the value equivalent to2017-08-22T19:41:35Z.The built-in formatters (such as
ISO_LOCAL_DATE_TIME) can't parse this format, so the only way seems to be creating a formatter.