Answers for "get date diff carbon laravel"

PHP
1

different days in carbon laravel between different dates

$created = new Carbon($survey->created_at);
$now = Carbon::now();
$difference = ($created->diff($now)->days < 1)
    ? 'today'
    : $created->diffForHumans($now);
Posted by: Guest on February-03-2021
0

diff for seconds laravel carbon

echo $tz = Carbon::now('Australia/Perth');
    $local='2017-04-11 12:39:50';
    echo $emitted = Carbon::parse($local);
    echo $diff = $tz->diffInSeconds($emitted);
Posted by: Guest on July-10-2021

Browse Popular Code Answers by Language