Home > Article > Backend Development > How to add one month to time in php
phpHow to add one month to the time
Use php’s strtotime() function
Example: For example, the current time is "2010-10-06", plus one month. 1653
echo date("Y-m-d", strtotime("+1 months", strtotime("2010-10-06")));
Specific application examples of strtotime in php:
<?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")); ?>
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of How to add one month to time in php. For more information, please follow other related articles on the PHP Chinese website!