Carbon::isWeekend

Returns true when the date falls on one of the configured weekend days, Saturday or Sunday by default.

Signature
public function isWeekend(): bool
  • Added in Laravel Carbon 1.0.0

Return value

booltrue when the instance's day-of-week number is in the configured weekend day list, false otherwise.

Changelog

  • PHP Carbon 2.xCarbon::setWeekendDays() was marked deprecated; the docblock recommends defining a macro such as isDayOff() instead of changing the global list.
  • PHP Carbon 3.0Native bool return type added, and the weekend day list moved onto the shared FactoryImmutable instance rather than a plain static property.

isWeekend() compares the instance's numeric day of week against the weekend list held by Carbon's shared factory. That list defaults to [Carbon::SATURDAY, Carbon::SUNDAY], which is [6, 0], and isWeekday() is simply its negation.

When to reach for it

Use it whenever a rule keys off the working week: skipping non-working days while walking a date range, deciding whether an SLA clock ticks, or picking the next day a job may run. It reads far better than in_array($date->dayOfWeek, [0, 6]) and keeps the definition of "weekend" in one place.

What trips people up

The weekend list is global to the process, not derived from the locale. Calling Carbon::setLocale('ar') changes month and day names and the first day of the week, but Friday still reports false from isWeekend(). The only switch is Carbon::setWeekendDays(), which is deprecated precisely because it is global — one package flipping it silently changes every other package's answer.

The other surprise is timezone. The day number comes from the instance's own zone, so a UTC timestamp late on Friday may already be Saturday for a user in Tokyo. Convert first, then ask.

Example

Try it yourself
Loading editor…
Press Run to execute the code.

When to use it

  • Filter a date range down to business days before scheduling deliveries.
  • Decide whether an overdue-invoice reminder should be held until Monday.
  • Apply weekend pricing to a booking without hard-coding day numbers.
  • Pause an SLA countdown on non-working days.

Frequently asked questions

How do I check if a date is a Saturday or Sunday in Laravel?

Call isWeekend() on the Carbon instance — $date->isWeekend() returns true for Saturday and Sunday by default. Its opposite, isWeekday(), returns true for Monday through Friday. Both read the day number in the instance's own timezone, so convert the date to the relevant zone first if the answer matters near midnight.

Why does isWeekend() still return false for Friday after I change the locale?

Because the weekend days are global configuration, not part of the locale. Carbon reads the array held by its shared factory, which defaults to [Carbon::SATURDAY, Carbon::SUNDAY], and setLocale() never touches it. Carbon::setWeekendDays() is the only thing that changes the answer, and it is deprecated because it affects every package in the process.

How do I define a custom weekend without breaking other packages?

Register a macro instead of calling setWeekendDays(). Carbon::macro('isDayOff', function () { return $this->isFriday() || $this->isSaturday(); }) gives you a clearly named method for your rule while leaving isWeekend() meaning Saturday and Sunday for everything else. Put the macro registration in a service provider's boot method.

More examples

Filtering a week down to business days

The seven-day window runs Monday 9 March to Sunday 15 March 2026. Rejecting the two weekend days leaves the five weekdays: 2026-03-09 through 2026-03-13. Note the ->copy() — without it, addDays() would mutate $start on every iteration and the offsets would compound.

Example · php
<?php

use Illuminate\Support\Carbon;

date_default_timezone_set('UTC');

$start = Carbon::parse('2026-03-09'); // a Monday

$businessDays = collect(range(0, 6))
    ->map(fn (int $offset) => $start->copy()->addDays($offset))
    ->reject(fn (Carbon $day) => $day->isWeekend())
    ->map(fn (Carbon $day) => $day->toDateString())
    ->values();

print_r($businessDays->all());

Locale does not move the weekend; setWeekendDays does

Under the Arabic locale Friday still reports false, because isWeekend() reads the factory's weekend array and never consults the translator. Only setWeekendDays() changes the answer — and because it is deprecated global state, restoring the default afterwards is the only safe way to use it.

Example · php
<?php

use Illuminate\Support\Carbon;

date_default_timezone_set('UTC');

$friday = Carbon::parse('2026-03-13');

Carbon::setLocale('ar');
echo 'locale ar          -> ', var_export($friday->isWeekend(), true), PHP_EOL;

// The list is global state, not locale state.
Carbon::setWeekendDays([Carbon::FRIDAY, Carbon::SATURDAY]);
echo 'after setWeekendDays -> ', var_export($friday->isWeekend(), true), PHP_EOL;

Carbon::setWeekendDays([Carbon::SATURDAY, Carbon::SUNDAY]); // put it back

A macro instead of global state

This is the approach Carbon's own deprecation notice recommends. isWeekend() keeps its Saturday/Sunday meaning for every other package in the application, while isDayOff() carries the region-specific rule. Friday reports isWeekend=false but isDayOff=true; Sunday is the reverse.

Example · php
<?php

use Illuminate\Support\Carbon;

date_default_timezone_set('UTC');

Carbon::macro('isDayOff', function (): bool {
    return $this->isFriday() || $this->isSaturday();
});

foreach (['2026-03-12', '2026-03-13', '2026-03-14', '2026-03-15'] as $date) {
    $day = Carbon::parse($date);

    printf(
        "%s  isWeekend=%-5s isDayOff=%s\n",
        $day->format('D'),
        var_export($day->isWeekend(), true),
        var_export($day->isDayOff(), true),
    );
}

Discussion

  • Be the first to comment on this lesson.