Here you can find the source of addDays(Date target, int days)
public static final Date addDays(Date target, int days)
//package com.java2s; /*//from ww w.jav a 2 s . co m * Copyright 2007 Sun Microsystems, Inc. * All rights reserved. You may not modify, use, * reproduce, or distribute this software except in * compliance with the terms of the License at: * http://developer.sun.com/berkeley_license.html */ import java.util.*; public class Main { public static final Date addDays(Date target, int days) { // returns a Date that is the sum of the target Date // and the specified number of days; // to subtract days from the target Date, the days // argument should be negative long msPerDay = 1000 * 60 * 60 * 24; long msTarget = target.getTime(); long msSum = msTarget + (msPerDay * days); Date result = new Date(); result.setTime(msSum); return result; } }