Here you can find the source of getBeforeHourByCurrentTime(Date now, int mount)
public static Date getBeforeHourByCurrentTime(Date now, int mount)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getBeforeHourByCurrentTime(Date now, int mount) { Calendar c = Calendar.getInstance(); c.setTime(now);//from w w w . j a va 2s . c o m c.set(Calendar.HOUR_OF_DAY, c.get(Calendar.HOUR_OF_DAY) + mount); return c.getTime(); } }