import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
public class Main {
public static void main(String[] args) {
int year = 2023;
Month month = Month.JULY;
int totalWorkingDays = 0;
int totalDays = month.length(year);
for (int day = 1; day <= totalDays; day++) {
LocalDate date = LocalDate.of(year, month, day);
DayOfWeek dayOfWeek = date.getDayOfWeek();
if (dayOfWeek != DayOfWeek.SATURDAY && dayOfWeek != DayOfWeek.SUNDAY) {
totalWorkingDays++;
}
}
System.out.println("Total working days in " + month + " " + year + ": " + totalWorkingDays);
}
}
标签:java,19,Month,int,time,import,打卡
From: https://www.cnblogs.com/wlxdaydayup/p/17566952.html