Here you can find the source of getDayRange(String bday, String eday)
public static String[] getDayRange(String bday, String eday)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static String[] getDayRange(String bday, String eday) { GregorianCalendar rightNow = new GregorianCalendar(Integer.parseInt(bday.substring(0, 4)), Integer.parseInt(bday.substring(4, 6)) - 1, Integer.parseInt(bday.substring(6, 8))); int i = 0; String s = null;//from w w w. ja v a2 s . com ArrayList al = new ArrayList(); al.add(bday); while (true) { i++; rightNow.add(Calendar.DAY_OF_YEAR, 1); s = getDefaultDateFormat().format(rightNow.getTime()); al.add(s); if (s.equals(eday)) break; } return (String[]) al.toArray(new String[0]); } public static int parseInt(String s) { return Integer.parseInt(isZero(s)); } public static SimpleDateFormat getDefaultDateFormat() { return new SimpleDateFormat("yyyyMMdd"); } public static String[] toArray(String s) { return toArray(s, ","); } public static String[] toArray(String s, String delim) { if (isNull(s)) return new String[0]; return s.split(delim); } public static String isZero(String o) { return (o == null || o.toString().trim().equals("")) ? "0" : o; } public static boolean isNull(Object s) { if (s == null || s.toString().trim().length() == 0 || s.equals("null")) return true; else return false; } }