Here you can find the source of addDay(int days)
public static Date addDay(int days)
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date addDay(Date date, int days) { if (date == null) { return null; }/*from w w w . j ava 2 s . c o m*/ GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); calendar.add(Calendar.DATE, days); return calendar.getTime(); } public static Date addDay(int days) { return addDay(new Date(), days); } public static Date setTime(Date date, int hours, int minutes, int seconds) { Calendar calendar = new GregorianCalendar(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, hours); calendar.set(Calendar.MINUTE, minutes); calendar.set(Calendar.SECOND, seconds); date = calendar.getTime(); return date; } }