Check if a Date Is a Weekend in Java

Check if a date is a weekend in Java with DayOfWeek and EnumSet, support Friday-Saturday weekends, time zones and weekend pricing examples.

A week from Monday to Sunday with Saturday and Sunday marked as the weekend in the default rule, and Friday and Saturday marked in a Friday-Saturday rule

To check if a date is a weekend in Java, we get its day with getDayOfWeek() and test whether the returned DayOfWeek is SATURDAY or SUNDAY. Java has no built-in isWeekend() method, so we write a small one, and the cleanest version tests an EnumSet of the weekend days.

Weekend checks drive weekend prices, delivery and support hours, payment dates that move to Monday and reports that leave out non-working days. The weekend is not Saturday and Sunday in every country, so a good check takes the weekend days as a parameter.

The following example looks at a Saturday and a Friday in October 2026.

LocalDate saturday = LocalDate.of(2026, 10, 17);
DayOfWeek day = saturday.getDayOfWeek();                                     // SATURDAY
boolean isWeekend = day == DayOfWeek.SATURDAY || day == DayOfWeek.SUNDAY;    // true
DayOfWeek friday = LocalDate.of(2026, 10, 16).getDayOfWeek();                // FRIDAY
boolean fridayIsWeekend = friday == DayOfWeek.SATURDAY || friday == DayOfWeek.SUNDAY;   // false

Notice that we compare enum constants with ==, which is safe for enums and cannot fail on a typo like a string comparison. We turn the check into a reusable method, support other weekend days, handle date-times and instants, and price a car rental with it.

1. A Reusable isWeekend() Method

The DayOfWeek enum gives every date one of seven constants, so a weekend check is a set membership test. An EnumSet stores enum constants as bits, which makes contains() fast, and it reads like the business rule.

static boolean isWeekend(LocalDate date) {
    return WEEKEND.contains(date.getDayOfWeek());
}

static final Set<DayOfWeek> WEEKEND = EnumSet.of(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
boolean saturday = isWeekend(LocalDate.of(2026, 10, 17));   // true
boolean sunday = isWeekend(LocalDate.of(2026, 10, 18));     // true
boolean monday = isWeekend(LocalDate.of(2026, 10, 19));     // false

Other ways to write the same check work too, but each one has a weak spot that the EnumSet does not have.

CheckResult for SaturdayWeak spot
day == SATURDAY || day == SUNDAYtrueHard-codes two days in every place that needs the rule
day.getValue() >= 6trueDepends on the ISO numbers 6 and 7, which a reader has to know
switch expression over daytrueGood for many outcomes, verbose for a yes or no answer
day.toString().equals(“SATURDAY”)trueA typo compiles and returns false
WEEKEND.contains(day)trueNone, and the set can be swapped per country

2. Weekends That Are Not Saturday and Sunday

Saudi Arabia and Egypt, for example, rest on Friday and Saturday, and many shops and hospitals have their own days off. An app for several regions passes the weekend days into the check instead of using one constant.

A week from Monday to Sunday with Saturday and Sunday marked as the weekend in the default rule, and Friday and Saturday marked in a Friday-Saturday rule
The same Friday is a weekday in one region and a weekend day in another
static boolean isWeekend(LocalDate date, Set<DayOfWeek> weekendDays) {
    return weekendDays.contains(date.getDayOfWeek());
}
Set<DayOfWeek> fridaySaturday = EnumSet.of(DayOfWeek.FRIDAY, DayOfWeek.SATURDAY);
LocalDate friday = LocalDate.of(2026, 10, 16);
boolean weekendThere = isWeekend(friday, fridaySaturday);   // true
boolean weekendHere = isWeekend(friday, WEEKEND);           // false

The JDK has no API that returns the weekend days of a locale. WeekFields knows only the first day of the week, which is a different rule, because the US week starts on Sunday while Sunday is still a weekend day. When we need weekend data per country, we keep a configuration table per region or use ICU4J Calendar.isWeekend(), which reads the CLDR weekend data.

3. Weekend Checks for Date-Times and Instants

A LocalDateTime, a ZonedDateTime and an OffsetDateTime all have getDayOfWeek(), so one method that accepts any TemporalAccessor covers them through DayOfWeek.from(). An Instant has no calendar day, and passing one throws a DateTimeException.

static boolean isWeekendAt(TemporalAccessor value) {
    return WEEKEND.contains(DayOfWeek.from(value));
}
boolean saturdayMorning = isWeekendAt(LocalDateTime.of(2026, 10, 17, 9, 0));   // true
Instant orderTime = Instant.parse("2026-10-17T03:30:00Z");
boolean inUtc = isWeekendAt(orderTime.atZone(ZoneOffset.UTC));                  // true
boolean inNewYork = isWeekendAt(orderTime.atZone(ZoneId.of("America/New_York"))); // false
boolean rawInstant = isWeekendAt(orderTime);                                    // DateTimeException

For timestamps, the weekend check is only correct in the time zone of the person or the business, because Friday 23:30 in New York is already Saturday in UTC. The order in the snippet counts as a weekday order for a shop in New York, even though a UTC server would call it a weekend order. Converting an Instant to a zone is covered in Instant to ZonedDateTime.

4. Weekend Pricing in a Car Rental App

A car rental company charges 40 per weekday and 55 per weekend day. For a rental from Thursday, October 15 to Tuesday, October 20, 2026, with the return day not charged, we stream the dates with datesUntil() and count the weekend days.

static long weekendDays(LocalDate start, LocalDate endExclusive) {
    return start.datesUntil(endExclusive).filter(d -> isWeekend(d)).count();
}
LocalDate pickUp = LocalDate.of(2026, 10, 15);
LocalDate dropOff = LocalDate.of(2026, 10, 20);
long totalDays = ChronoUnit.DAYS.between(pickUp, dropOff);    // 5
long weekend = weekendDays(pickUp, dropOff);                  // 2
long price = weekend * 55 + (totalDays - weekend) * 40;       // 230

Two adjusters answer the related questions, namely when the next weekend starts and which weekday follows a weekend. Holidays are not weekend days, so a rule such as “move the due date to the next working day” also needs a holiday list, as shown in adding business days.

LocalDate thursday = LocalDate.of(2026, 10, 15);
LocalDate nextSaturday = thursday.with(TemporalAdjusters.nextOrSame(DayOfWeek.SATURDAY));   // 2026-10-17
LocalDate sundayDue = LocalDate.of(2026, 10, 18);
LocalDate nextWorkday = sundayDue.with(TemporalAdjusters.next(DayOfWeek.MONDAY));           // 2026-10-19

5. Checking a java.util.Date for a Weekend

Legacy code passes java.util.Date values around, and an old JDBC driver can return them too. We turn the Date into a LocalDate in the right zone and reuse the same isWeekend() method, instead of writing a second check with Calendar.

Date legacy = Date.from(Instant.parse("2026-10-17T10:00:00Z"));
LocalDate converted = legacy.toInstant().atZone(ZoneId.of("UTC")).toLocalDate();   // 2026-10-17
boolean legacyWeekend = isWeekend(converted);                                       // true

The deprecated constructor Date(int year, int month, int day) is a trap in such code. It adds 1900 to the year and counts months from 0, so new Date(2021, 0, 2) is January 2, 3921 and not the Saturday of 2021 the author meant. That date happens to be a Sunday, so a weekend test passes for the wrong reason and hides the bug.

6. Check if a Date Is a Weekend FAQs

Java has no weekend method of its own, so the follow-up questions are about library options and about skipping weekends in date arithmetic.

6.1. Does Java have a built-in isWeekend() method?

No. Neither LocalDate nor DayOfWeek has one, so we write the method from section 1. Groovy adds isWeekend() to DayOfWeek, and ICU4J has Calendar.isWeekend(), but plain Java needs the EnumSet check.

6.2. How do I check if today is a weekend?

We call isWeekend(LocalDate.now(zone)) with the zone of the user or the business, such as ZoneId.of(“Europe/London”). A call without a zone reads the server’s default zone.

6.3. How do I skip weekends when adding days to a date?

We add one day at a time and count only the days that are not weekend days or holidays. The complete method, including subtraction, is in the business days article linked in section 4.

6.4. How do I count the weekdays between two dates?

The answer is a stream of dates from datesUntil(), counting the ones where isWeekend() returns false. For long ranges and holidays, counting business days shows a faster formula.

7. Conclusion

A weekend check in Java is WEEKEND.contains(date.getDayOfWeek()) with an EnumSet of the weekend days. Passing the set as a parameter supports Friday and Saturday weekends and per-customer rules.

Date-times work through DayOfWeek.from(), while instants and legacy Date values need a time zone first. Weekend prices, next working days and day counts all build on the same small method. Related recipes are in the Java date and time guide.

8. References

Happy Learning !!

Source Code on Github

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.