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;
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;
相关文章推荐
- php抓取网页上的指定内容
- PHP中的traits
- PHP_curl模拟高并发请求
- php.ini详解
- php curl 抓取内容
- yii2下使用支付宝
- 今天你说520了吗?不仅有php表白书还有java表白神器
- php-命名空间
- 了解thinkphp(三)
- PHP 监控服务器动态
- PHP性能优化大全(php.ini)
- [转]THINKPHP--MVC模式
- [转]PHP--优化PHP代码建议
- php环境搭建
- 颜色处理
- java,php,js;AES 互通加解密
- Yii2中使用自定义的数据库
- phpMyAdmin创建mysql用户无法登陆/提示密码错误
- PHP查找中文字符的解决方案
- 跨控制器操作-thinkphp