PHP中的strtotime()函数
该strtotime()函数将英语文本日期或时间解析为Unix时间戳。成功返回时间戳,否则返回FALSE。在PHP5.1.0之前,此函数在失败时将返回-1。
语法
strtotime(time, now)
参数
时间 -指定时间的字符串进行解析。
现在 -时间戳用于计算返回的值。
返回
该strtotime()函数返回成功时间戳,否则返回FALSE。在PHP5.1.0之前,此函数在失败时将返回-1。
示例
以下是一个例子-
<?php $timestamp = strtotime( "June 20, 2018" ); print date( 'Y-m-d', $timestamp ); ?>
输出结果
2018-06-20
示例
让我们看另一个例子-
<?php
echo(strtotime("now") . "<br>");
echo(strtotime("10 March 2018") . "<br>");
echo(strtotime("+10 hours") . "<br>");
?>输出结果
1539235161 1520640000 1539271161
热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便