Here you can find the source of toTimestamp(Date date)
public static Timestamp toTimestamp(Date date)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.util.*; public class Main { public static Timestamp toTimestamp(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w w w.j a v a 2 s. c om calendar.set(Calendar.MILLISECOND, 0); return new Timestamp(calendar.getTimeInMillis()); } }