RITESH GUPTA
RITESH GUPTA

Reputation: 93

Failed to parse date ["2016-08-29 11:08:37.645007"]: Invalid time zone indicator ' '

i have jsondata in which one of the field is date and its value looks like

"2016-08-29 11:08:37.645007" i using gson to get the deserialized object from json but it throws following execetion

`

Caused by: java.text.ParseException: Failed to parse date ["2016-08-29 11:08:37.645007"]: Invalid time zone indicator ' '
    at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:274)
    at com.google.gson.DefaultDateTypeAdapter.deserializeToDate(DefaultDateTypeAdapter.java:149)
    ... 64 more
Caused by: java.lang.IndexOutOfBoundsException: Invalid time zone indicator ' '
    at com.google.gson.internal.bind.util.ISO8601Utils.parse(ISO8601Utils.java:245)
    ... 65 more

`

im not sure what should be the format of date tried "yyyy-MM-dd'T'HH:mm:ss.SSSZ" but it didnt work

Upvotes: 3

Views: 7410

Answers (1)

Robert Kock
Robert Kock

Reputation: 6038

The date you're trying to parse doesn't contain a timezone.
Try the format string yyyy-MM-dd HH:mm:ss.SSSSSS

Upvotes: 4

Related Questions