Here you can find the source of getTimestamp(Date date)
public static Timestamp getTimestamp(Date date)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Timestamp getTimestamp(Date date) { return Timestamp.valueOf(dateStr(date)); }/*from ww w . j ava2 s . c om*/ public static String dateStr(Date date) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String newStr = dateFormat.format(date); return newStr; } }