Here you can find the source of addDays(Date date, int days)
public static Date addDays(Date date, int days)
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date addDays(Date date, int days) { Calendar cal = Calendar.getInstance(); cal.setTime(date);// ww w . ja v a2 s . c o m cal.add(Calendar.DATE, days); //minus number would decrement the days return cal.getTime(); } public static Date setTime(final Date date, final int hourOfDay, final int minute, final int second) { final GregorianCalendar gc = new GregorianCalendar(); gc.setTime(date); gc.set(Calendar.HOUR_OF_DAY, hourOfDay); gc.set(Calendar.MINUTE, minute); gc.set(Calendar.SECOND, second); return gc.getTime(); } }