Here you can find the source of addDaysToDate(Date date, int numDays)
public static Date addDaysToDate(Date date, int numDays)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date addDaysToDate(Date date, int numDays) { Calendar c = Calendar.getInstance(); c.setTime(date);//from ww w.j a va 2s .com c.add(Calendar.DATE, numDays); return c.getTime(); } public static String getTime(java.util.Date date) { return format(date, "HH:mm:ss"); } public static String format(java.util.Date date, String format) { String result = ""; try { if (date != null) { java.text.DateFormat df = new java.text.SimpleDateFormat(format); result = df.format(date); } } catch (Exception e) { } return result; } public static String format(java.util.Date date) { return format(date, "yyyy/MM/dd"); } }