I'm trying to enter a start date, an end date, and obtain all the dates in between. I have the formatting where I need it, I have Joda-Time ready to go, but...past that, I'm stuck. I've included what I have working, as well as what is not going.
So far, I have the following code (working):
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
DateFormat sysDate = new SimpleDateFormat("ddMMyyyy");
//Get Start Date
Date str_date = jXDatePicker1.getDate();
jXDatePicker1.setFormats(dateFormat);
String startDate = sysDate.format(jXDatePicker1.getDate());
//Get End Date
Date end_date = jXDatePicker2.getDate();
jXDatePicker2.setFormats(dateFormat);
String endDate = sysDate.format(jXDatePicker2.getDate());
And here's what I'm trying to implement but to no success:
List<LocalDate> dates = new ArrayList<LocalDate>();
int days = Days.daysBetween(startDate, endDate).getDays();
for (int i=0; i < days; i++) {
LocalDate d = startDate.withFieldAdded(DurationFieldType.days(), i);
dates.add(d);
}
Thank you in advance.