JAVA SP T


Lets dive into snapshot of my programs!💻

24. How to convert Timestamp to Date.

💡Code:

import java.sql.Timestamp;
                import java.util.Date;
                
                public class TimestampToDateConversion7078 {
                    public static void main(String[] args) {
                        // Example Timestamp
                        Timestamp timestampValue = new Timestamp(System.currentTimeMillis());
                
                        // Convert Timestamp to Date
                        Date dateValue = new Date(timestampValue.getTime());
                
                        // Print the converted Date value
                        System.out.println("Converted Date value: " + dateValue);
                    }
                }
                
           

📸Output :

output