Here you can find the source of getDayStr(int i, String formatStr)
public static String getDayStr(int i, String formatStr)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static String getDayStr(int i, String formatStr) { GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance(); gc.setTime(new Date()); gc.add(Calendar.DATE, i); SimpleDateFormat formatter = new SimpleDateFormat(formatStr); String dateString = formatter.format(gc.getTime()); return dateString; }/*from w w w . j a v a2 s . com*/ }