Java tutorial
import java.util.Calendar; import java.util.Date; public class Util { /** * Utility for setting the time on a date. * @param date * @param h * @param m * @param s * @return the date with the time set */ public static Date setTime(Date date, int h, int m, int s) { if (date == null) return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR, h); calendar.set(Calendar.MINUTE, m); calendar.set(Calendar.SECOND, s); return calendar.getTime(); } }