Home >> Snippet List >> Snippet

Name
Convert minutes to hours #2
Description
Convert minutes to a decimal hours and minutes format, ie "125" hours
PHP Snippet
<?PHP
$hours = SPRINTF(%d:%02d, ABS((int)$min/60), ABS((int)$min%60));
 
//convert to "1.25" hours
$elapsedTime = SPRINTF("%01.1f", $elapsed_mins/60);
 
?>