1. 程式人生 > >獲得這兩個時間的所有天數及其周幾

獲得這兩個時間的所有天數及其周幾

List<DateUtil> dateList = new ArrayList<>();

long distance = ChronoUnit.DAYS.between(todayLocal, plusXDayLocal);

Stream.iterate(todayLocal, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> {
    DateUtil d = new DateUtil();
    d.setDate(f.toString());
    d.setWeekly(EnumUtil.WEEKLY.getValueByCode(f.getDayOfWeek().toString()));
    dateList.add(d);
});