Here you can find the source of addDay(Date d, int amount)
public static Date addDay(Date d, int amount)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Date addDay(Date d, int amount) { return add(d, Calendar.DATE, amount); }// w w w . j a v a 2 s . co m public static Date add(Date d, int field, int amount) { if (d == null) { return null; } Calendar calendar = Calendar.getInstance(); calendar.setTime(d); calendar.add(field, amount); return calendar.getTime(); } public static Date getTime(String date) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.parse(date); } }