如何使用java8 time API获得一个月的两个特定日期之间的所有周末?
LocalDate startDate = LocalDate.of(2018, 10, 26); LocalDate endDate = LocalDate.of(2018, 11, 27); while (startDate.isBefore(endDate)) { if (startDate.getDayOfWeek().equals(DayOfWeek.SATURDAY) || startDate.getDayOfWeek().equals(DayOfWeek.SUNDAY)) { System.out.println(startDate + ":" + startDate.getDayOfWeek()); } startDate = startDate.plusDays(1); }