Here you can find the source of getDayBeforeOrAfter2(Date time, int days)
public static Date getDayBeforeOrAfter2(Date time, int days)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getDayBeforeOrAfter2(Date time, int days) { Calendar calendar = Calendar.getInstance(); calendar.setTime(time);// w w w. j a va 2 s .c o m calendar.add(Calendar.DAY_OF_MONTH, days); return calendar.getTime(); } }