Here you can find the source of addDate(Date date, int field, int add)
public static Calendar addDate(Date date, int field, int add)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Calendar addDate(Date date, int field, int add) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/* ww w . j a va 2s .com*/ calendar.add(field, add); // switch (field) { // case Calendar.YEAR: // case Calendar.MONTH: // case Calendar.DAY_OF_MONTH: // case Calendar.HOUR_OF_DAY: // case Calendar.MINUTE: // case Calendar.SECOND: // case Calendar.MILLISECOND: // calendar.set(field, calendar.get(field)+1); // default: // break; // } return calendar; } }