Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getDateStr(int index) { SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); java.util.Calendar calendar = new java.util.GregorianCalendar(); calendar.add(Calendar.DATE, index); String retDate = ""; try { retDate = df.format(calendar.getTime()); } catch (Exception ex) { ex.printStackTrace(); } return retDate; } }