Here is my code :
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("MM-dd-yyyy");
if(rs.next())
{
event.get(i).setDateofbirth(rs.getDate("DOB_EMP").toLocalDate().format(FORMATTER)); // this line is giving error
}
Here is the error trace :
com.ibm.db2.jcc.am.SqlException: [jcc][1093][10425][4.19.66] Invalid data conversion: Parameter instance is invalid for the requested conversion to java.sql.Date. ERRORCODE=-4220, SQLSTATE=null
I tried giving the date in this format :
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-mm-dd");
But I got this error:
java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: MinuteOfHour