例如:
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")).'<br>';
运行结果为:
1458980310 1128268800 1458998310 1459585110 1459869515 1459094400 1458403200
如果想要查看这个时间戳对应的时间,例如:
echo date("Y-m-d H:i:s",strtotime("now")).'<br>';
echo date("Y-m-d H:i:s",strtotime("next Thursday")).'<br>';
运行结果为:
2016-03-26 16:21:32 2016-03-31 00:00:00
PS:本站还提供了一个Unix时间戳转换工具,包含了各种常见语言针对时间戳的操作方法,提供给大家参考:
Unix时间戳(timestamp)转换工具:
http://tools.jb51.net/code/unixtime
更多关于PHP相关内容感兴趣的读者可查看本站专题:《php日期与时间用法总结》、《PHP数组(Array)操作技巧大全》、《PHP数据结构与算法教程》、《php程序设计算法总结》、《php正则表达式用法总结》、《php字符串(string)用法总结》及《php常见数据库操作技巧汇总》
希望本文所述对大家PHP程序设计有所帮助。







