Convert number of minutes into hours & minutes using PHP
$hours = floor($final_time_saving / 60);
$minutes = $final_time_saving % 60;
<?php
function convertToHoursMins($time, $format = '%02d:%02d') {
if ($time < 1) {
return;
}
$hours = floor($time / 60);
$minutes = ($time % 60);
return sprintf($format, $hours, $minutes);
}
echo convertToHoursMins(250, '%02d hours %02d minutes'); // should output 4 hours 17 minutes
echo date('H:i', mktime(0,257));