/**
* 获取一段时间的每一天日期
*
* @param start
* @param end
* @return
* @throws Exception
*/
public static List<String> getBetweenDate(String start, String end) {
List<String> list = new ArrayList<>();
LocalDate startDate = LocalDate.parse(start);
LocalDate endDate = LocalDate.parse(end);
long distance = ChronoUnit.DAYS.between(startDate, endDate);
if (distance < 1) {
return list;
}
Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> list.add(f.toString()));
return list;
}
//调用 List<String> betweenDate = getBetweenDate("2019-02-01", "2019-05-31");