Here you can find the source of getFormattedNowDatePlusDays(int days, String dateFormat)
public static String getFormattedNowDatePlusDays(int days, String dateFormat)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getFormattedNowDatePlusDays(int days, String dateFormat) { Date nowDate = getNowDate(); Date futureDate = addDaysToDate(nowDate, days); return dateToString(futureDate, dateFormat); }//w w w . ja v a2s . c om public static Date getNowDate() { return Calendar.getInstance().getTime(); } private static Date addDaysToDate(Date date, int daysCount) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DATE, daysCount); return calendar.getTime(); } private static String dateToString(Date date, String format) { DateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); } }