Here you can find the source of getDateWithDiff(Date date, int amount)
public static Date getDateWithDiff(Date date, int amount)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**//from w ww . j a va2 s. c o m * * @return */ public static Date getDateWithDiff(Date date, int amount) { return getDateWithDiff(date, amount, Calendar.DATE); } /** * * @return */ public static Date getDateWithDiff(Date date, int amount, int field) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(field, amount); return calendar.getTime(); } }