Updated June 2026. Tested on Laravel 13 and PHP 8.4.
Dates in plain PHP are awkward: strtotime, format strings, manual maths. Carbon wraps all of that in a clean API, and the good news is that Laravel ships with it. Every date column you cast to datetime comes back as a Carbon instance, so you already have it everywhere.
use Carbon\Carbon;
Getting a date
$now = Carbon::now(); // current date and time
$today = Carbon::today(); // today at 00:00
$yesterday = Carbon::yesterday();
$tomorrow = Carbon::tomorrow();
// parse a plain English phrase
$newYear = Carbon::parse('first day of January 2027');
// in a specific timezone
$nowInQatar = Carbon::now('Asia/Qatar');
Creating a specific date
Carbon::createFromDate(2026, 6, 5); // a date
Carbon::createFromTime(22, 30, 0); // a time today
Carbon::create(2026, 6, 5, 22, 30, 0); // a full date and time
Adding and subtracting
This is where Carbon shines. Say you want a trial to end 30 days from now.
$trialEndsAt = Carbon::now()->addDays(30);
The add and subtract methods cover every unit, and they chain.
$dt = Carbon::create(2026, 1, 31);
$dt->addYears(2);
$dt->addMonths(3)->subDays(10);
$dt->addWeeks(2);
$dt->addHours(6)->addMinutes(30);
Reading parts of a date
$dt = Carbon::now();
$dt->year;
$dt->month;
$dt->day;
$dt->hour;
$dt->dayOfWeek;
$dt->daysInMonth;
Formatting
$dt = Carbon::now();
$dt->toDateString(); // 2026-06-05
$dt->toFormattedDateString(); // Jun 5, 2026
$dt->toDateTimeString(); // 2026-06-05 22:30:16
$dt->format('l jS F Y'); // Friday 5th June 2026
Human readable differences
This is the one you reach for on a blog or a feed: showing "3 hours ago" instead of a timestamp. diffForHumans does it.
$post->created_at->diffForHumans(); // 3 hours ago
$start->diffInDays($end); // a plain number
$start->diffInHours($end);
diffForHumans adapts to the direction on its own: a past date reads "3 hours ago", a future one reads "3 hours from now", and comparing two dates reads "3 hours before" or "after".
It is already on your models
Because Laravel casts date columns to Carbon, you do not even import it for model dates.
$user->created_at->addWeek();
$order->shipped_at->diffForHumans();
$invoice->due_at->isPast();
That last one hints at the boolean helpers Carbon gives you, like isToday, isPast, isWeekend and isBetween, which keep date logic readable. Carbon turns date handling from a chore into one liners. Questions welcome in the comments.
All comments ()
No comments yet
Be the first to leave a comment on this post.