//タイムゾーンを設定します
date_default_timezone_set('Asia/Shanghai');
/**
* 時刻の秒数、年、月、日、時、分、秒の形式
*
* @author wangyupeng129@126.com
* @param int $time
* @return配列|ブール値
*/
function Sec2Time($time){
if(is_numeric($time)){
$value = array(
"年" => 0, "日" => 0, "時間" => 0,
"分" => 0, "秒" => 0,
);
if($time >= 31556926){
$value["years"] = Floor($time/31556926);
$time = ($time1556926);
}
if($time >= 86400){
$value["days"] = Floor($time/86400);
$time = ($time�400);
}
if($time >= 3600){
$value["hours"] = Floor($time/3600);
$time = ($time600);
}
if ($time >= 60){
$value[" minutes"] = Floor($time/60);
$time = ($time`);
}
$value[ "秒"] = Floor($time);
return (array) $value;
}else{
return (bool) FALSE;
}
}
//このサイトが作成された時刻
$site_create_time = strtotime('2013-05-22 00:00:00');
$time = time() - $site_create_time;
$uptime = Sec2Time($time);
?>