PHP中如何给日期加上一个月/天

使用php的strtotime
实例:比如现在时间是“2017-07-06”,加一个月。

echo   date("Y-m-d", strtotime("+1 months", strtotime("2017-07-06")));
<?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"));
?>
print_r(date('Y-m-d H:i:s',strtotime("+1 month")));

 

posted @ 2017-07-20 12:49  周伯通之草堂  阅读(6691)  评论(0编辑  收藏  举报