Skip to content

Instantly share code, notes, and snippets.

@kamekoopa
Created February 14, 2012 02:24
Show Gist options
  • Save kamekoopa/1822625 to your computer and use it in GitHub Desktop.
Save kamekoopa/1822625 to your computer and use it in GitHub Desktop.
秒数 -> array({日数}, {時間数}, {分数}, {秒数}) 形式に変換する関数
<?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