Here you can find the source of getBeforeOrAfterDay(Date date, String format, Integer days)
public static String getBeforeOrAfterDay(Date date, String format, Integer days)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getBeforeOrAfterDay(Date date, String format, Integer days) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w w w .j a va 2 s . co m calendar.add(Calendar.DAY_OF_MONTH, days); SimpleDateFormat df = new SimpleDateFormat(format); return df.format(calendar.getTime()); } }