Here you can find the source of getNextDay(String day)
public static String getNextDay(String day)
//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 getNextDay(String day) { return getDeltaDay(day, 1); }/* w w w . j a va2 s . c o m*/ 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()); } public static String format(Date date, String formatPattern) { if (date == null) { return ""; } else { return new SimpleDateFormat(formatPattern).format(date); } } public static SimpleDateFormat getDefaultDateFormat() { return new SimpleDateFormat("yyyyMMdd"); } }