Here you can find the source of getTimestamp(Timestamp timestamp, int day, int hour, int minute)
public static Timestamp getTimestamp(Timestamp timestamp, int day, int hour, int minute)
//package com.java2s; import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Timestamp getTimestamp(Timestamp timestamp, int day, int hour, int minute) { Calendar calendar = new GregorianCalendar(); if (timestamp != null) { calendar.setTimeInMillis(timestamp.getTime()); } else {//w ww .j a v a 2 s .c o m calendar = Calendar.getInstance(); } calendar.add(Calendar.DATE, day); calendar.set(Calendar.HOUR, hour); calendar.set(Calendar.MINUTE, minute); return new Timestamp(calendar.getTimeInMillis()); } public static Timestamp add(Date date, int calendarField, int amount) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } Calendar c = Calendar.getInstance(); c.setTime(date); c.add(calendarField, amount); return new Timestamp(c.getTimeInMillis()); } }