如何将秒数转换成天时分秒的详细表示?
- 内容介绍
- 文章标签
- 相关推荐
本文共计77个文字,预计阅读时间需要1分钟。
phpfunction vtime($time) { $output=''; foreach (array(86400=> '天', 3600=> '小时', 60=> '分', 1=> '秒') as $key=> $value) { if ($time >=$key) { $output .=floor($time / $key) . $value; $time %=$key; } } return $output;}
/** * PHP 格式化秒 */ 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; }
本文共计77个文字,预计阅读时间需要1分钟。
phpfunction vtime($time) { $output=''; foreach (array(86400=> '天', 3600=> '小时', 60=> '分', 1=> '秒') as $key=> $value) { if ($time >=$key) { $output .=floor($time / $key) . $value; $time %=$key; } } return $output;}
/** * PHP 格式化秒 */ 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; }

