您的位置:首页 > 编程语言 > PHP开发

php 时间秒数转换成H:i:s

2016-05-20 16:00 656 查看
function changeTimeType($seconds){
if ($seconds>3600){
$hours = intval($seconds/3600);
$minutes = $seconds-3600*$hours;
$time = $hours.":".gmstrftime('%M:%S', $minutes);
}else{
$time = gmstrftime('%H:%M:%S', $seconds);
}
return $time;
}

$seconds = 3800;

echo changeTimeType($seconds);exit;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: