1. 程式人生 > >PHP中如何給日期加上一個月/天

PHP中如何給日期加上一個月/天

echo php date hour 現在 strtotime seconds 如何 nds

使用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")));

PHP中如何給日期加上一個月/天