Home > Backend Development > PHP Problem > How to add days to the current time in php

How to add days to the current time in php

藏色散人
Release: 2023-03-04 20:08:01
Original
4289 people have browsed it

How to increase the number of days in php: 1. Add one day to the current time through the "date('Y-m-d',strtotime(" 1 day"))" method; 2. Use "strtotime(" 1 month The ")" method adds one month to the current time.

How to add days to the current time in php

Recommended: "PHP Video Tutorial"

How to add days and months in php

Add one day to the current time: echo date('Y-m-d',strtotime(" 1 day"))

Add one month to the current time: strtotime(" 1 month")

The current time is increased by one year: strtotime(" 1 year")

The current time is increased by one second: strtotime(" 1 seconds")

The existing time is increased by one day :

$d='2012-10-11';
eccho date('Y-m-d',strtotime("{$d} +1 day"));
Copy after login

More are

echo   strtotime( 'yesterday ') 
echo   date( "Ymd ",strtotime( 'last   week '));
Copy after login

The above is the detailed content of How to add days to the current 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