![](https://img.php.cn/upload/article/000/000/050/5ed5cd6c0d3c5836.jpg)
php时间格式转换
将秒转换成时分秒
function cktime($billsec){ $cktime = ''; if($billsec>'0'){ $cktime = gmstrftime('%H:%M:%S',$billsec); } return $cktime; }
生成当前时间戳并按格式显示时间
$time = time();//获取时间戳 $nowtime = date('Y-m-d H:i:s',$time);//生成规定的时间格式
将确切的事件转为时间戳
$oldtime = '2010-11-10 22:19:21'; $catime = strtotime($oldtime);
打印明天此时的时间戳
strtotime(”+1 day“)
打印昨天此时的
strtotime(”-1 day“)
打印下个星期此时的时间戳
strtotime(”+1 week“)
打印指定下星期几的PHP时间戳
strtotime(”next Thursday“)
打印指定上星期几的时间戳
strtotime(”last Thursday“)
推荐教程:《PHP教程》
以上就是php如何进行时间格式的转换的详细内容,更多请关注php中文网其它相关文章!
![php中文网最新课程二维码](/static/images/article_wechat2021.jpg?1111)
声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
- 上一篇:php数组如何去除空元素
- 下一篇:php如何使时间增加一个月
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论