I want a list of dates between start date and end date.
The result should be a list of all dates including the start and end date.
You can also look at the Date.getTime() API. That gives a long to which you can add your increment. Then create a new Date.
List dates = new ArrayList();
long interval = 1000 * 60 * 60; // 1 hour in millis
long endtime = ; // create your endtime here, possibly using Calendar or Date
long curTime = startDate.getTime();
while (curTime <= endTime) {
dates.add(new Date(curTime));
curTime += interval;
}
and maybe apache commons has something like this in DateUtils, or perhaps they have a CalendarUtils too :)
EDIT
including the start and enddate may not be possible if your interval is not perfect :)