Here you can find the source of add(Date date, int calendarField, int amount)
Parameter | Description |
---|---|
date | a parameter |
calendarField | a parameter |
amount | a parameter |
public static Date add(Date date, int calendarField, int amount)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { /**/* w ww . ja v a 2 s . co m*/ * * @param date * @param calendarField * @param amount * @return the date after modify * @author Mei Xianzhi */ public static Date add(Date date, int calendarField, int amount) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } else { Calendar c = Calendar.getInstance(); c.setTime(date); c.add(calendarField, amount); return c.getTime(); } } }