LocalDate today = LocalDate.now();
LocalDate monday = today.with(TemporalAdjusters.previousOrSame( DayOfWeek.MONDAY));
LocalDate sunday = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY ));
获取三个工作日后的日期
TemporalAdjuster nextThreeWorkingDay = TemporalAdjusters.ofDateAdjuster(
temporal -> {
DayOfWeek dow =
DayOfWeek.of(temporal.get(ChronoField.DAY_OF_WEEK));
int dayToAdd;
switch (dow){
case SATURDAY:
dayToAdd = 4;
break;
case FRIDAY:
case THURSDAY:
case WEDNESDAY:
dayToAdd = 5;
break;
default:
dayToAdd = 3;
}
return temporal.plus(dayToAdd, ChronoUnit.DAYS);
});
LocalDate registeredDate = now.with(nextThreeWorkingDay);