Here you can find the source of getDateBefore(Date date, Integer before)
public static Date getDateBefore(Date date, Integer before)
//package com.java2s; //License from project: Apache License import java.sql.Date; public class Main { public static Date getDateBefore(Date date, Integer before) { if (before == 0) { return new Date(date.getTime()); }/*from www . j av a 2 s .co m*/ Date d = new Date(date.getTime()); for (int i = 0; i < before; i++) { d.setTime(d.getTime() - 86400000); } return d; } }