JDBC ResultSet: I need a getDateTime, but there is only getDate and getTimeStamp

This answer is outdated. Continue to Basil Bourque’s answer.

java.util.Date date;
Timestamp timestamp = resultSet.getTimestamp(i);
if (timestamp != null)
    date = new java.util.Date(timestamp.getTime()));

Then format it the way you like.

Leave a Comment