函数: The strtotime()
功能:将任何英文文本的时间转换为UNIX时间戳(从1970年1月1日(GMT)起经过的秒数),进行一些代数运算
Parameter参数 | Description描述 |
---|---|
time | Required. Specifies the time string to parse 必要参数。指定需要被解析的时间字符串。 |
now | Optional. Specifies the timestamp used to calculate the returned value. If this parameter is omitted, current time is used 可选参数。指定用来计算返回值的时间戳。如果这个参数被忽略,那么将默认使用当前时间 |
<?
php
echo ( strtotime ( " now " ) . " <br /> " );
echo ( strtotime ( " 3 October 2005 " ) . " <br /> " );
echo ( strtotime ( " +5 hours " ) . " <br /> " );
echo ( strtotime ( " +1 week " ) . " <br /> " );
echo ( strtotime ( " +1 week 3 days 7 hours 5 seconds " ) . " <br /> " );
echo ( strtotime ( " next Monday " ) . " <br /> " );
echo ( strtotime ( " last Sunday " ));
?>
echo ( strtotime ( " now " ) . " <br /> " );
echo ( strtotime ( " 3 October 2005 " ) . " <br /> " );
echo ( strtotime ( " +5 hours " ) . " <br /> " );
echo ( strtotime ( " +1 week " ) . " <br /> " );
echo ( strtotime ( " +1 week 3 days 7 hours 5 seconds " ) . " <br /> " );
echo ( strtotime ( " next Monday " ) . " <br /> " );
echo ( strtotime ( " last Sunday " ));
?>
输出:
1138614504 1128290400 1138632504 1139219304 1139503709 1139180400 1138489200 |