Created
September 11, 2011 10:00
-
-
Save rskull/1209412 to your computer and use it in GitHub Desktop.
9500秒を何時間何分何秒に変換
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 | |
//秒を時間に変換 | |
function oclock ($s) { | |
$h = 0; | |
$m = 0; | |
while ($s >= 60) { | |
if ($s >= 3600) { | |
$s -= 3600; | |
$h++; | |
} else { | |
$s -= 60; | |
$m++; | |
} | |
} | |
return "{$h}時間{$m}分{$s}秒"; | |
} | |
//9500秒を変換 | |
echo oclock(9500); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment