The first step will be to use SimpleDateFormat to parse it into a fully functional java.util.Date instance in the controller:
Date date = new SimpleDateFormat("dd-MMM-yyyy HH:mm.", Locale.ENGLISH).parse(dateVal);
Then you can simply create java.sql.Date around its time in the database layer:
statement.setDate(1, new java.sql.Date(date.getTime()));
Not tied to a specific problem, note that java.sql.Date does not remember the temporary part. If you have a DATETIME or TIMESTAMP field in the database and not a DATE field, use setTimestamp() with setTimestamp() instead. Thus, the temporary part will also be saved.
Balusc
source share