Home > Backend Development > PHP Problem > How to add one month to time in php

How to add one month to time in php

L
Release: 2023-03-01 11:26:01
Original
6646 people have browsed it

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")));
Copy after login

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

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template