<?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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…