private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
public static List<String> getMiddleDate(String begin, String end) {
LocalDate beginLocalDate = localDate(begin);
LocalDate endLocalDate = localDate(end);
List<String> localDateList = new ArrayList<>();
long length = endLocalDate.toEpochDay() - beginLocalDate.toEpochDay();
for (long i = length; i >= 0; i--) {
LocalDate localDate = endLocalDate.minusDays(i);
String localDateStr = localDate.format(DATE_TIME_FORMATTER);
localDateList.add(localDateStr);
}
return localDateList;
}
public static LocalDate localDate(String date) {
return LocalDate.parse(date,DATE_TIME_FORMATTER);
}