如何使用PHP得到当前时间戳
php的strtotime() 函数用来将任何英文文本的日期时间描述解析为 Unix 时间戳。
它接受一个包含美国英语日期格式的字符串并尝试将其解析为 Unix 时间戳(自 January 1 1970 00:00:00 GMT 起的秒数),其值相对于now参数给出的时间,如果没有提供此参数,则用系统当前时间。
举例说明:
<?php
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"));
?>


评论
还没有评论。
发表评论