import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
public class DateRangeProgram {
// Generate a list of dates from start to end (inclusive)
public static List<LocalDate> generateDates(LocalDate start, LocalDate end) {
List<LocalDate> dates = new ArrayList<>();
if (start.isAfter(end)) {
return dates; // empty
}
for (LocalDate d = start; !d.isAfter(end); d = d.plusDays(1)) {
dates.add(d);
}
return dates;
}
public static void main(String[] args) {
LocalDate start = LocalDate.of(2026, 1, 3);
LocalDate end = LocalDate.of(2026, 1, 12);
List<LocalDate> dates = generateDates(start, end);
System.out.println("Generated " + dates.size() + " dates:");
for (LocalDate d : dates) {
System.out.println(d);
}
}
}
/*
run:
Generated 10 dates:
2026-01-03
2026-01-04
2026-01-05
2026-01-06
2026-01-07
2026-01-08
2026-01-09
2026-01-10
2026-01-11
2026-01-12
*/