Here you can find the source of setHours(Date date, int amount)
public static Date setHours(Date date, int amount)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date setHours(Date date, int amount) { return set(date, Calendar.HOUR_OF_DAY, amount); }/*from w ww . j a v a 2s. com*/ public static Date set(Date date, int calendarFiled, int amount) { if (null == date) { throw new IllegalArgumentException("The date must not be null"); } else { } Calendar c = Calendar.getInstance(); c.setTime(date); c.set(calendarFiled, amount); return c.getTime(); } }