php怎么实现日期增加一个月

本文以php实现日期增加一个月为例,为大家分析php日期函数的使用方法。阅读完整文相信大家对php日期函数的使用方法有了一定的认识。

使用php的strtotime()函数

实例:比如现在时间5261是“2010-10-06”,加4102一个月。1653

echo   date("Y-m-d", strtotime("+1 months", strtotime("2010-10-06")));

php的strtotime的具体应用实例:

<?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"));
?>

以上就是php实现日期增加一个月为例的方法,代码示例简单明了,如果在日常工作遇到此问题。通过这篇文章,希望你能有所收获,更多详情敬请关注行业资讯频道!