Answers for "laravel carbon get seconds"

PHP
1

add seconds to datetime carbon

Try to parse() it first:
$date = Carbon::parse($dateTime)
            ->addSeconds($seconds)
            ->format('Y-m-d H:i:s');
Posted by: Guest on July-06-2020
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