[php]秒数转换成年、月、日、分、秒格式
秒数转换成年、月、日、分、秒格式
var_dump(vtime(12111111));
function vtime($time){
$output = '';
foreach (array(86400 => '天', 3600 => '小时', 60 => '分', 1 => '秒') as $key => $value) {
if ($time >= $key) $output .= floor($time/$key) . $value;
$time %= $key;
}
return $output;
}
- 上一篇: HTML直接在DIV里输入文字的方法
- 下一篇: 没有了
评论已关闭,有啥想法可联系我们