Here you can find the source of toTimestamp(final int year, final int month, final int dayOfMonth, final int hour, final int minute, final int second, final int millsecond)
public static Timestamp toTimestamp(final int year, final int month, final int dayOfMonth, final int hour, final int minute, final int second, final int millsecond)
//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 toTimestamp(final int year, final int month, final int dayOfMonth, final int hour, final int minute, final int second, final int millsecond) { Calendar cal = Calendar.getInstance(); cal.set(year, month - 1, dayOfMonth, hour, minute, second); cal.set(Calendar.MILLISECOND, millsecond); return new Timestamp(cal.getTimeInMillis()); }//from w w w.j a v a 2 s . c om public static Timestamp toTimestamp(final Date date) { return new Timestamp(date.getTime()); } }