Last date is not getting printed in org.joda.time.LocalDate?

Insomnia365

New Member
This is what is my code to print between two dates and it excludes the saturday and sunday but this one does not print the last date of the given month.\[code\]import org.joda.time.DateTimeConstants;import org.joda.time.LocalDate;public class DatesexcludingWeekend { public static void main(String[] args) { final LocalDate start = new LocalDate(2012, 05, 1); final LocalDate end = new LocalDate(2012, 05, 31); LocalDate weekday = start; if (start.getDayOfWeek() == DateTimeConstants.SATURDAY|| start.getDayOfWeek() == DateTimeConstants.SUNDAY) { weekday = weekday.plusWeeks(1).withDayOfWeek(DateTimeConstants.MONDAY); } while (weekday.isBefore(end)) { String dateValues[] = weekday.toString().split("-"); //System.out.println(dateValues[2]+"/"+dateValues[1]+"/"+dateValues[0]); String date=dateValues[2]+"/"+dateValues[1]+"/"+dateValues[0]; System.out.println("date : "+date); if (weekday.getDayOfWeek() == DateTimeConstants.FRIDAY) weekday = weekday.plusDays(3); else weekday = weekday.plusDays(1); } }}\[/code\]Here is the out put of the above code : \[code\]date : 01/05/2012date : 02/05/2012date : 03/05/2012date : 04/05/2012date : 07/05/2012date : 08/05/2012date : 09/05/2012date : 10/05/2012date : 11/05/2012date : 14/05/2012date : 15/05/2012date : 16/05/2012date : 17/05/2012date : 18/05/2012date : 21/05/2012date : 22/05/2012date : 23/05/2012date : 24/05/2012date : 25/05/2012date : 28/05/2012date : 29/05/2012date : 30/05/2012\[/code\]if you see this \[code\]31-05/2012\[/code\] is not getting printedPlease help me to get this solved.RegardsTony
 
Top