Converting milliseconds to Timestamp in Java
31,227
Use constructor.
new Timestamp(System.currentTimeMillis())
http://docs.oracle.com/javase/7/docs/api/java/sql/Timestamp.html#Timestamp(long)
Author by
user3313539
Updated on July 09, 2022Comments
-
user3313539 almost 2 years
I am using System.currentTimeMillis() and adding the value of a day/week/month based on user input. How can I convert this to java.sql.Timestamp so I can save it in mysql? Thanks.