Here you can find the source of addDate(Date date, int amount, int type)
public static Date addDate(Date date, int amount, int type)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { private final static Calendar cal = Calendar.getInstance(); public static Date addDate(Date date, int amount, int type) { cal.setTime(date);/*from w ww . j a v a2 s . c o m*/ // cal.add(field, amount) switch (type) { case Calendar.DATE: cal.add(Calendar.DATE, amount); } return cal.getTime(); } public static Date addDate(long time, int amount, int type) { Date date = new Date(time); return addDate(date, amount, type); } }