Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'fixedEndTime'; nested exception is java.lang.IllegalArgumentException: Could not parse date: Unparseable date: "2017-May-19 10:05:00"
Asked
Active
Viewed 2,634 times
-5
-
Is this a Spring framework error? – Adam May 17 '17 at 05:36
1 Answers
1
To parse string into java.util.Date
use java.text.SimpleDateFormat
.
Example :
String testDate = "09-May-2015,23:10:14 PM";
DateFormat formatter = new SimpleDateFormat("d-MMM-yyyy , HH:mm:ss aaa");
Date date = formatter.parse(testDate);
System.out.println(date);

Jay Smith
- 2,331
- 3
- 16
- 27
-
FYI, the troublesome old date-time classes such as [`java.util.Date`](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html), [`java.util.Calendar`](https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html), and `java.text.SimpleTextFormat` are now [legacy](https://en.wikipedia.org/wiki/Legacy_system), supplanted by the [java.time](https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html) classes. See [Tutorial by Oracle](https://docs.oracle.com/javase/tutorial/datetime/TOC.html). – Basil Bourque May 17 '17 at 07:06