php时间操作

函数: The strtotime()
功能:将任何英文文本的时间转换为UNIX时间戳(从1970年1月1日(GMT)起经过的秒数),进行一些代数运算

Parameter参数Description描述
timeRequired. Specifies the time string to parse
必要参数。指定需要被解析的时间字符串。
nowOptional. 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 " ));
?>  

输出:

1138614504
1128290400
1138632504
1139219304
1139503709
1139180400
1138489200
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值