Created
May 10, 2017 09:15
-
-
Save alash3al/8d474bb3824a97b27a16257d6563d720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert the specified minutes (int) to the specified format (hours) | |
* | |
* @author Mohammed Al Ashaal <https://alash3al.xyz> | |
* @version 1.0 | |
* @return string | |
*/ | |
function minutes2hours($m, $format = "%02d:%02d") { | |
if ( $m < 60 ) { | |
$hours = 0; | |
$minutes = $m; | |
} else { | |
$hours = (int) ($m / 60); | |
$minutes = (int) ($m % 60); | |
} | |
return sprintf($format, $hours, $minutes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment