I can not make the issue of the date go ... I was looking at other posts but none ended up giving me results.
I receive the date as follows in AngularJS:
2019-05-04T09:00:00Z
And from Grails I handle it in the following way:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSSX");
Date d = sdf.parse(parametros.volverallamar);
But when trying to save it I receive the following error:
Unparseable date: "2019-05-03T09:00:00Z". Stacktrace follows:
THANKS!
You are defining a date format with milliseconds (.SSSSSSS
) but your actual input date does not have them.
Use a format without:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
Date d = sdf.parse("2019-05-04T09:00:00Z");