Home > php教程 > PHP源码 > php 时间数据转换为时间戳代码

php 时间数据转换为时间戳代码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:25:06
Original
1248 people have browsed it

要做时间数据转换为时间戳我们利用php自带函数,strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳

<script>ec(2);</script>

要做时间数据转换为时间戳我们利用php教程自带函数,strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳

格式一 Fri Aug 05 12:19:04 +0800 2011

strtotime("Fri Aug 05 12:19:04 +0800 2011");

格式二 2011-02-01

strtotime("2011-02-01");

其它参考

echo(strtotime("now"));
echo(strtotime("3 October 2005"));
echo(strtotime("+5 hours"));
echo(strtotime("+1 week"));
echo(strtotime("+1 week 3 days 7 hours 5 seconds"));
echo(strtotime("next Monday"));
echo(strtotime("last Sunday"));
?>输出:

1138614504
1128290400
1138632504
1139219304
1139503709
1139180400
1138489200

好了关于strtotime函数的实例也就这么多了,有需要的朋友可以参考一下。

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template