Support the ongoing development of Laravel.io →
Requests Input

Hey, is it possible to get the number of days that have passed since a given timestamp, but only the value? Carbon's difference for humans does this, but it returns "x days ago" instead of the value only.

Last updated 3 years ago.
0

The diffForHumans method removes the ago, after, etc. if you pass false as the second parameter.

If you literally just want days and not hours, minutes, etc., then you can do something like this.

$diffInDays = $model->some_timestamp->diffInDays();
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Joe96 joe96 Joined 28 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.