How to convert Timestamp to Date in Java -JDBC Example Tutorial

In the last article, I have shown you how to convert Date to Timestamp in Java and today we'll learn about converting timestamp value from database to Date in Java. As you remember, the JDBC API uses separate Date, Time and Timestamp class to confirm DATE, TIME and DATETIME data type from the database, but most of the Java object oriented code is written in java.util.Date. This means you need to know how to convert the timestamp to date and vice-versa. You can do by using the getTime() method, which return the number of millisecond from Epoch value. This can be used to create both Timestamp and java.util.Date, hence it acts as a bridge between Date class from java.util package and Date, Time and Timestamp class from the java.sql package. Like Date, Timestamp also contains both date and time value, so you won't see empty or zero time we saw previously while converting SQL Date to java.util.Date.