Convert minutes to hours with PHP
Free Scripts :: PHP :: Date and Time :: Convert minutes to hours with PHP
Author: Salman Javaid
Website: http://www.salman.be
Website: http://www.salman.be
- Convert minutes to hours.
- How to convert minutes to hours with php.
- Calculate hours from minutes.
Function accepts 2 parameters. Hours and the minutes. Then it converts minutes to hours.
Function
function calculate($hour, $min) {
if (($min-60) < 0) {
$total = "$hour:$min";
return $total;
}
else {
$min -= 60;
$hour += 1;
calculate($hour, $min);
}
}
Calling The Function
echo calculate(4,433);
Output
11:30




