java8 LocalDate 判断一年中的标准周末和工作日
void myTest4() { LocalDate date = LocalDate.of(2020, 1, 1); while (date.getYear() < 2021){ DayOfWeek week = date.getDayOfWeek(); if(week == DayOfWeek.SATURDAY || week == DayOfWeek.SUNDAY) { System.out.println(date.toString()+"->周末"); }else { System.out.println(date.toString()+"->工作日"); } date = date.plusDays(1); } }