The code works perfectly. But there is a small problem. I don't get the end date also in my List. How do I choose to include/exclude the start date and include the end date ?
Do, I do that manually by using remove() and add() or can Joda API do that for me?
解决方案
Based on API, it seems there is no direct way to choose include.
One hack may be, just add +1 to number of days.
List dates = new ArrayList();
int days = Days.daysBetween(startDate, endDate).getDays()+1;
for (int i=0; i < days; i++) {
LocalDate d = startDate.withFieldAdded(DurationFieldType.days(), i);
dates.add(d);
}