Here you can find the source of dateToTimeStamp(java.util.Date date)
public static Timestamp dateToTimeStamp(java.util.Date date)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; public class Main { public static Timestamp dateToTimeStamp(java.util.Date date) { Calendar cal = dateToCalendar(date); return calToTimeStamp(cal); }/*from w w w . j a va 2 s .com*/ public static Calendar dateToCalendar(Date date) { if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; } public static Timestamp calToTimeStamp(Calendar cal) { Timestamp tm = null; if (cal == null) { tm = null; } else { tm = new Timestamp(cal.getTime().getTime()); } return tm; // return (cal == null) ? null : new // Timestamp(cal.getTime().getTime()); } }