在按日拉取数据的程序中,经常用到。主要使用Java8的LocalDate#isBefore()方法
public static void main(String[] args) throws InterruptedException, ExecutionException {
//逐日打印日期
LocalDate startDate = LocalDate.of(2020, 11, 11);
LocalDate endDate = LocalDate.of(2020, 12, 1);
/*
几种方法用来判断日期,isBefore()、isAfter()、isEqual()
*/
while(startDate.isBefore(endDate)){
System.out.println(startDate);
startDate = startDate.plusDays(1);
}
}