mardi 24 mars 2015

Iterate between two date range using Joda



In My code i need to iterate between range of dates using Joda, and I already tried this



for(LocalDate currentdate = startDate; currenDate.isBefore(endDate); currenDate= currenDate.plusDays(1)){
System.out.println(currentdate);
}


above code is working, but the iteration stop when currenDate reaching the day before endDate. what i want to achieve is the iteration stop when currentDate exactly the same as endDate.



for(Date currentdate = startDate; currentdate <= endDate; currentdate++){
System.out.println(currentdate );
}


I know the code above is impossible , but I do it to make clear what I'd want.


and sorry for my bad english, hope you understand




Aucun commentaire:

Enregistrer un commentaire