Here you can find the source of getDeltaDay(String day, int delta)
public static String getDeltaDay(String day, int delta)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static String getDeltaDay(String day, int delta) { GregorianCalendar rightNow = new GregorianCalendar(Integer.parseInt(day.substring(0, 4)), Integer.parseInt(day.substring(4, 6)) - 1, Integer.parseInt(day.substring(6, 8))); rightNow.add(Calendar.DAY_OF_YEAR, delta); return getDefaultDateFormat().format(rightNow.getTime()); }/*from w ww . j a v a2s . c om*/ public static int parseInt(String s) { return Integer.parseInt(isZero(s)); } public static SimpleDateFormat getDefaultDateFormat() { return new SimpleDateFormat("yyyyMMdd"); } public static String isZero(String o) { return (o == null || o.toString().trim().equals("")) ? "0" : o; } }