I am using Joda time api in a Spring 3.0 project for the very first time. Now I have a start and end date and I want to get the date for all mondays between these two dates.
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
public class Get_time {
public ArrayList getmondays(String s,String e)
{
LocalDate start = LocalDate.parse(s);
LocalDate end = LocalDate.parse(e);
List totalDates_Mondays = new ArrayList<>();
while (!start.isAfter(end)) {
totalDates_Mondays.add(start);
start = start.plusWeeks(1);
}
return (ArrayList) totalDates_Mondays;
}
public static void main(String ...s1) {
String mon_start = "1600-08-01";
String mon_end= "2016-12-29";
Get_time t=new Get_time();
System.out.println(t.getmondays(mon_start,mon_end));
}
}