Here you can find the source of getBeforeOrAfterDateByDayNumber(int dayNumber)
public static Date getBeforeOrAfterDateByDayNumber(int dayNumber)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getBeforeOrAfterDateByDayNumber(int dayNumber) { return getBeforeOrAfterDateByDayNumber(new Date(), dayNumber); }/*from ww w .j a v a 2s . c om*/ public static Date getBeforeOrAfterDateByDayNumber(Date date, int dayNumber) { Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.DAY_OF_MONTH, dayNumber); return c.getTime(); } }