Wednesday, 3 June 2015

seconds to duration

<?php function duration($len){ 
    
$hr floor($len 60 60); 
    
$min floor($len 60); 
    
$sec floor($len 60); 
    return array(
'hr' => $hr'min' => $min,'sec' => $sec); 
} 
$dur 28853.45; $totals duration($dur); 

echo 
$totals['hr'].' hours, '.$totals['min'].' minutes and '.$totals['sec'].' seconds.'; ?>

0 comments:

Post a Comment