PHP: seconds to days mins hours
public function strTime($s) {
$d = intval($s/86400);
$s -= $d*86400;
$h = intval($s/3600);
$s -= $h*3600;
$m = intval($s/60);
$s -= $m*60;
if ($d) $str = $d . ' day ';
if ($h) $str .= $h . ' hour(s) ';
if ($m) $str .= $m . ' minute(s) ';
if ($s) $str .= $s . ' second(s)';
return $str;
}
ba31d7ca-0665-4e41-93d6-802b9288d260
Created on: 12th October, 2022
Last updated: 12th October, 2022
Tagged With: