Here you can find the source of dateAdd(Date date, int days)
public static String dateAdd(Date date, int days)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String dateAdd(Date date, int days) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); String toDate = dateFormat.format(new Date()); return dateAdd(toDate, days); }// w ww. j a v a2 s.com public static String dateAdd(String date, int days) { Calendar cal = Calendar.getInstance(); int year = 0, month = 0, day = 0; try { year = Integer.parseInt(date.substring(0, 4)); month = Integer.parseInt(date.substring(4, 6)); day = Integer.parseInt(date.substring(6, 8)); } catch (Exception e) { } cal.set(year, month - 1, day + days); SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd"); return sf.format(cal.getTime()); } }