If you wish to convert minutes to hours and minutes display or convert minutes to minutes and second display here is a super useful function to do so:

function convertTo($time, $format = '%02d:%02d') {
    if ($time < 1) {
        return;
    }
    $hours = floor($time / 60);
    $minutes = ($time % 60);
    return sprintf($format, $hours, $minutes); // this also will return fine for converting minutes to minutes:seconds
}

 

You might find interesting:   Calculate Age of somebody in PHP

NO COMMENTS

LEAVE A REPLY