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

How to add days to the current time in php

藏色散人
藏色散人Original
2020-08-20 10:04:364250browse

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

More are

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

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!

Statement:
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