Here you can find the source of getDatebetweenOfDays(Date startDate, Date endDate)
public static List<Date> getDatebetweenOfDays(Date startDate, Date endDate)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; public class Main { public static List<Date> getDatebetweenOfDays(Date startDate, Date endDate) { List<Date> list = new ArrayList<Date>(); GregorianCalendar gc1 = new GregorianCalendar(), gc2 = new GregorianCalendar(); gc1.setTime(startDate);//from w ww. j a v a2s . c o m gc2.setTime(endDate); do { GregorianCalendar gc3 = (GregorianCalendar) gc1.clone(); list.add(gc3.getTime()); System.out.println(gc3.getTime()); gc1.add(Calendar.DAY_OF_MONTH, 1); } while (!gc1.after(gc2)); return null; } public static Date getTime(final int day) { return getTime(new Date(), day); } public static Date getTime(final Date date, final int day) { final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.DATE, calendar.get(Calendar.DATE) + day); return calendar.getTime(); } }