set timestamp java code example
Example 1: java timestamp
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
//2016-11-16 06:43:19.77
Copy
Example 2: date to timestamp java
All you need to do is change the string within the java.text.SimpleDateFormat constructor to: "MM-dd-yyyy HH:mm:ss".
Just use the appropriate letters to build the above string to match your input date.