Here you can find the source of getSomeDaysBeforeAfter(Date date, int days)
public static Date getSomeDaysBeforeAfter(Date date, int days)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date getSomeDaysBeforeAfter(Date date, int days) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(date);/* w w w . j av a 2 s . co m*/ gc.add(5, days); gc.set(gc.get(Calendar.YEAR), gc.get(Calendar.MONTH), gc.get(Calendar.DATE)); return gc.getTime(); } }