php - 时间操作

ini_set('date.timezone','Asia/Shanghai');

 

http://www.w3school.com.cn/php/func_date_strtotime.asp

 

strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳。

 

例子

<?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"));   // 秒: strtotime("+300 seconds");
echo(strtotime("next Monday"));
echo(strtotime("last Sunday"));
?>

输出:

1138614504
1128290400
1138632504
1139219304
1139503709
1139180400
1138489200
posted @ 2016-05-16 00:43  贝尔塔猫  阅读(257)  评论(0编辑  收藏  举报