if (!function_exists('secondsToTime')) {
function secondsToTime($seconds_time = 0){
if(is_numeric($seconds_time) && $seconds_time > 0){
$seconds_time = (int)$seconds_time;
$remainder_m = $seconds_time % 3600;
$hours = ($seconds_time - $remainder_m) / 3600;
$remainder_s = $remainder_m % 60;
$minutes = ($remainder_m - $remainder_s) / 60;
$seconds = $remainder_s;
$hours = str_pad($hours, 2, "0", STR_PAD_LEFT );
$minutes = str_pad($minutes, 2, "0", STR_PAD_LEFT );
$seconds = str_pad($seconds, 2, "0", STR_PAD_LEFT );
return "$hours:$minutes:$seconds";
}else{
return "00:00:00";
}
}
}
echo secondsToTime(96528);
will give 26:48:48