您的位置:首页 > 编程语言 > PHP开发

php strtotime函数和date函数用法

2014-02-13 08:20 411 查看
测试用例
echo date('Y-m-d:H:i:s',strtotime("now")), "\n";
echo date('Y-m-d:H:i:s',strtotime("10 September 2000")),
"\n";
echo date('Y-m-d:H:i:s',strtotime("+1 day")), "\n";
echo date('Y-m-d:H:i:s',strtotime("+1 week")), "\n";
echo date('Y-m-d:H:i:s',strtotime("+1 week 2 days 4 hours 2
seconds")), "\n";
echo date('Y-m-d:H:i:s',strtotime("next Thursday")),
"\n";
echo date('Y-m-d:H:i:s',strtotime("last Monday")), "\n";
输出结果

2014-01-27:15:09:54
2000-09-10:00:00:00
2014-01-28:15:09:54
2014-02-03:15:09:54
2014-02-05:19:09:56
2014-01-30:00:00:00
2014-01-20:00:00:00
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: