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.util.Calendar; import java.util.Date; public class Main { public static Timestamp getTimestamp(Date date) { return new Timestamp(removeMilis(date).getTime()); }//from ww w . ja v a 2 s . c om public static Date removeMilis(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date); c.set(Calendar.MILLISECOND, 0); return c.getTime(); } }