I have a database date field which return as
resultSet.getDate("startDate");
I would like to change the format of this to dd-MMM-yy
and preserve as date type which means I wouldn't like to convert it to String.
I have the following code snippet to change date format
private Date getDate(ResultSet resultSet,Date columnName)
SimpleDateFormat format1 = new SimpleDateFormat("dd-MMM-yy");
String date =
new SimpleDateFormat("dd-MMM-yy").format(columnName);
What is the best approach to convert String again back to date with same date format
dd-MMM-yy