I need to check if a date (in a string) exists in a list of arrays.
I have two dates, first I need to create date ranges between these two dates and store them in an array. This is what I do.
DateTimeFormatter dateFromatter= DateTimeFormat.forPattern("MM/dd/yyyy"); DateTime startDate= formatter.parseDateTime("01/02/2012"); DateTime endDate= formatter.parseDateTime("01/31/2012"); List<LocalDate> dates = new ArrayList<LocalDate>(); int days = Days.daysBetween(startDate, endDate).getDays(); for (int i=0; i < days; i++) {
This is where I get the problem.
Type mismatch: cannot convert from DateTime to LocalDate > LocalDate listOfDates = > startDate.withFieldAdded(DurationFieldType.days(), i); > dates.add(listOfDates); }
Namita
source share