Carbon::addDays
Adds a number of days to a Carbon instance, mutating it in place.
public function addDays(int|float $value = 1): static- Added in Laravel Carbon 1.0
Parameters
| Parameter | Type | Description |
|---|---|---|
$$valueoptional | int|float= 1 | Number of days to add. Negative values subtract; a fractional value adds the corresponding part of a day, so 1.5 adds a day and twelve hours. |
Return value
staticThe same instance, moved forward by the given number of days ($this for the mutable Carbon class, a new instance for CarbonImmutable).
Errors
Throws Carbon\Exceptions\UnitException when the value cannot be interpreted as a number of days.
Changelog
- PHP 3.0Documented as addDays(int|float $value = 1); the method is resolved through Carbon's magic __call and delegates to addUnit('day', ...).
addDays() moves a date forward using a date interval, which means it works in calendar days rather than fixed 86,400-second blocks. Across a daylight-saving change the wall-clock time is preserved: 12:00 plus 15 days is still 12:00, even though fewer or more real hours elapsed. That is almost always what a due date or a reminder wants.
It mutates
The plain Carbon class — and Illuminate\Support\Carbon, which extends it — is mutable. $due->addDays(3) moves $due itself and returns the same object, so a date you stored earlier is quietly rewritten and any variable pointing at it changes too. Call copy() first, or start from a fresh instance, when the original must survive. CarbonImmutable flips this: every call returns a new instance and the original is untouched.
Days are safe, months are not
Day arithmetic has no overflow trap, but its siblings do: addMonth() on 31 January lands on 3 March, because February has no 31st. Use addMonthNoOverflow() when you want the end of the shorter month instead.
Fractional values are allowed — addDays(1.5) adds 36 hours.
Example
When to use it
- Setting a payment due date a fixed number of days after issue.
- Scheduling a reminder relative to an event date.
- Building a rolling window such as the next 14 days of availability.
Frequently asked questions
Why did addDays change my original date?
Because Carbon\Carbon and Illuminate\Support\Carbon are mutable — addDays() modifies the instance and returns it. Call ->copy() before adding, or use CarbonImmutable, when the original value must survive.
Does addDays handle daylight saving time?
Yes. It adds a calendar day interval, so the wall-clock time is preserved across a DST change even though the elapsed real time is 23 or 25 hours for that day. Use addRealDays() when you want exact 24-hour blocks instead.
How do I add a month without landing in the wrong one?
Use addMonthNoOverflow() or addMonthsNoOverflow(): plain addMonth() on 31 January overflows to 3 March, while the no-overflow variant clamps to 28 or 29 February. Day arithmetic is not affected by this.
More examples
A due date on a model
Without copy(), addDays() would rewrite the issued_at attribute in place and Eloquent would persist the shifted value alongside the due date. endOfDay() then makes the deadline inclusive of the whole final day.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Invoice extends Model
{
protected function casts(): array
{
return ['issued_at' => 'datetime', 'due_at' => 'datetime'];
}
public function scheduleDueDate(int $terms = 30): void
{
// issued_at is a Carbon instance; copy() keeps the column intact.
$this->due_at = $this->issued_at->copy()->addDays($terms)->endOfDay();
$this->save();
}
}Mutable versus immutable
The mutable call returns the very same object it was called on — the identity check proves it — so the original date is gone. CarbonImmutable returns a new instance and leaves the original readable, which is why it is the safer choice for values held on a model or in a config.
<?php
use Carbon\Carbon;
use Carbon\CarbonImmutable;
$mutable = Carbon::parse('2026-03-14');
$result = $mutable->addDays(5);
var_dump($mutable->toDateString()); // string(10) "2026-03-19"
var_dump($result === $mutable); // bool(true)
$immutable = CarbonImmutable::parse('2026-03-14');
$shifted = $immutable->addDays(5);
var_dump($immutable->toDateString()); // string(10) "2026-03-14"
var_dump($shifted->toDateString()); // string(10) "2026-03-19"Building a rolling window
today() is called fresh inside the loop, so each iteration starts from an untouched midnight instance. Hoisting it into a variable outside the loop would compound the additions and produce 14, 15, 17, 20, 24 March.
<?php
use Carbon\Carbon;
Carbon::setTestNow('2026-03-14 09:41:07');
$slots = [];
for ($i = 0; $i < 5; $i++) {
$slots[] = today()->addDays($i)->format('D d M');
}
print_r($slots);
// Array
// (
// [0] => Sat 14 Mar
// [1] => Sun 15 Mar
// [2] => Mon 16 Mar
// [3] => Tue 17 Mar
// [4] => Wed 18 Mar
// )
Carbon::setTestNow();
Discussion