I am using gson to convert serialized message to object, but I have problem with converting one attribute to java.sql.Timestamp
The start time attribute in JSON is
{...other_fields, "start_time": "2020-05-27 05:23:43.022610"}
And my Gson parser is initialized this way
new GsonBuilder().serializeNulls().setDateFormat("yyyy-MM-dd HH:mm:ss.S").create();
The object is parsed properly, but the start time has different minutes and seconds values as it should. The result of parse start time is: 2020-05-27 05:24:05.61
What am I missing?
Edit1:
Java Version:
1.8
Gson version:2.8.2
Edit2:
After change format to
yyyy-MM-dd HH:mm:ss
(omitting milliseconds) I got the right result, but without milliseconds value. I can live with that, but it would be nice if someone could still explain this issue.