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

  1. Convert minutes to hours.
  2. How to convert minutes to hours with php.
  3. 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

Comments

No comments. Be the first one.

Leave a comment

Full Name*
Comments*
Security Code*

Our Partners

Getty Icons  Salman Creations
Free High Quality Images  Learn Free Languages 
Opal Hosting  R-Tech Solutions
  • Submit a Script

    Click here to submit your script.