Created
February 14, 2012 02:24
-
-
Save kamekoopa/1822625 to your computer and use it in GitHub Desktop.
秒数 -> array({日数}, {時間数}, {分数}, {秒数}) 形式に変換する関数
This file contains 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 | |
/** | |
* 秒数 -> array({日数}, {時間数}, {分数}, {秒数}) 形式に変換する関数 | |
*/ | |
function convertToDHMS($sec) { | |
$day = floor($sec / 86400); | |
$hour = floor($sec / 3600) % 24; | |
$minute = floor($sec / 60) % 60; | |
$second = $sec % 60; | |
return array($day, $hour, $minute, $second); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment