Answers for "laravel seconds to hours minutes seconds"

PHP
1

laravel seconds to hours minutes seconds

$value = '90060';
$dt = Carbon::now();
$days = $dt->diffInDays($dt->copy()->addSeconds($value));
$hours = $dt->diffInHours($dt->copy()->addSeconds($value)->subDays($days));
$minutes = $dt->diffInMinutes($dt->copy()->addSeconds($value)->subDays($days)->subHours($hours));
echo CarbonInterval::days($days)->hours($hours)->minutes($minutes)->forHumans();
Posted by: Guest on November-05-2020
0

time left laravel seconds

//seconds and human time readable
$endTime = Carbon::parse("2021-09-23 19:15:16");
$startTime = Carbon::parse("2021-09-23 19:15:14");
$timeleft = $startTime->diffForHumans($endTime);
return $timeleft;
//output => time_left: "2 second before"
Posted by: Guest on September-21-2021

Code answers related to "laravel seconds to hours minutes seconds"

Browse Popular Code Answers by Language