Java tutorial
import java.sql.Timestamp; import java.util.Date; public class Main { public static void main(String[] args) { System.out.println(convertToSqlTimestamp(new Date())); } public static java.sql.Timestamp convertToSqlTimestamp(Date date) { return new Timestamp(date.getTime()); } }