I have a problem with a data type "Date", which I get from a JSON API.
I have an object that contains these two types of Dates.
@SerializedName("DateDebut")
public Date dateDebut;
@SerializedName("DateFin")
public Date dateFin;
When I post I don't get any errors but on the response.body it goes into catch and I have this error.
Failed to parse date ["2021-05-26T00:00:00"]: No time zone indicator
The type of data I receive is this "DateDebut": "2021-04-21T13: 56: 55.552Z".
I believe it is a DateTime type, while I in my application Date.
@SerializedName("DateDebut")
public String dateDebutReq;
@SerializedName("DateFin")
public String dateFinReq;
public Date dateDebut;
public Date dateFin;
If I create two more String types, everything works fine, but I have to leave the Dates for the post.
I would like to avoid having two types 4 elements instead of two.
I have found articles that recommend adding the time zone to the parse in this way
dateFormat.timeZone = TimeZone.getTimeZone ("GMT");
but I have the problem with the reception where I do not do any part Do you have solutions? Thanks