import java.sql.Timestamp;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class MainClass {
public static void main(String[] a) {
System.out.println(makeTimestamp(2002,02,02,02,02,02,02));
}
public static Timestamp makeTimestamp(int year, int month, int day, int hour, int minute,
int second, int millisecond) {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DATE, day);
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, minute);
cal.set(Calendar.SECOND, second);
cal.set(Calendar.MILLISECOND, millisecond);
// now convert GregorianCalendar object to Timestamp object
return new Timestamp(cal.getTimeInMillis());
}
}
2002-02-02 02:02:02.002