[java] 주말 제외한 이전 5일 구하기
·
Language/JAVA
import java.time.DayOfWeek; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; public class PreviousDaysExcludingWeekends { public static List getPreviousWeekdays(int days) { List weekdays = new ArrayList(); LocalDate date = LocalDate.now().minusDays(1); // start from yesterday while (weekdays.size() < days) { if (!isWeekend(date)) { weekdays.add(date); } date = date...