php处理时间的函数
- strtotime() 函数将任何英文文本的日期或时间描述解析为 Unix 时间戳
-
<?php echo(strtotime("now") . "<br>"); echo(strtotime("15 October 1980") . "<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")); ?>
- mktime():从日期取得时间戳。
-
<?php
//mktime(hour,minute,second,month,day,year) $d=mktime(10, 20, 11, 8, 3, 2017); echo "创建日期是 " . date("Y-m-d h:i:sa", $d); ?> - date()格式化时间戳