Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 694
RITESH GUPTA Avatar asked Sep 01 '25 04:09

RITESH GUPTA


1 Answers

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

like image 190
Robert Kock Avatar answered Sep 08 '25 18:09

Robert Kock