PHP specified timestamp plus 1 days, 1 weeks, January, a year is actually no need to use what function! The specified timestamp itself is a digital integer, we only need to calculate 1 days, 1 weeks its number of seconds to add!
Blogger Search PHP specifies a timestamp plus one year, resulting in a number of articles giving the result is the function used:strtotime(); This function is really good for you, There are two ways to do this: first, you need to format the specified timestamp before using this function to add a day, a year ... , and all the platforms on the internet did not talk about this knowledge point! Second: Directly with the function of the 2nd parameter, a lot of people use this function is basically not the 2nd parameter, the default 2nd parameter is to get the current timestamp, and we can also customize the timestamp, this knowledge point on the Internet is not explained, even PHP manuals did not explain it!
For details, refer to PHP Functions:strtotime ();
The following is a number of methods to achieve PHP in the specified period of time plus one day, the method of a year, please look carefully PHP code, do not understand the Welcome to comment! I'll fix it for you!
<?PHPEcho Date(' Y-m-d h:i:s ',Strtotime(' Now '));//current timestamp 2017-01-09 21:04:11Echo Date(' Y-m-d h:i:s ',Strtotime(' +1second '));//Current Timestamp + 1 sec 2017-01-09 21:04:12Echo Date(' Y-m-d h:i:s ',Strtotime(' +1minute '));//current timestamp + 1 minutes 2017-01-09 21:05:11Echo Date(' Y-m-d h:i:s ',Strtotime(' +1hour '));//current timestamp + 1 hours 2017-01-09 22:04:11Echo Date(' Y-m-d h:i:s ',Strtotime(' +1day '));//current timestamp + 1 days 2017-01-10 21:04:11Echo Date(' Y-m-d h:i:s ',Strtotime(' +1week '));//current timestamp + 1 weeks 2017-01-16 21:04:11Echo Date(' Y-m-d h:i:s ',Strtotime(' +1month '));//current timestamp +1 months 2017-02-09 21:04:11Echo Date(' Y-m-d h:i:s ',Strtotime(' +1year '));//current timestamp + 1 years 2018-01-09 21:04:11Echo Date(' Y-m-d h:i:s ',Strtotime(' +12year 12month 12day 12hour 12minute 12second '));//current timestamp + 12, December, 12 days, 12 hours, 12 minutes, 12 seconds 2030-01-22 09:16:23$t= 1483967416;//Specify a time stampEcho $dt=Date(' Y-m-d h:i:s ',$t);//2017-01-09 21:10:16/*Method One*/Echo Date(' Y-m-d h:i:s ',$t+1*24*60*60);//Specify time stamp + 1 days 2017-01-10 21:10:16Echo Date(' Y-m-d h:i:s ',$t+365*24*60*60);//Specify time stamp + 1 year 2018-01-09 21:10:16/*Method Two*///$dt is the date after the specified timestamp is formattedEcho Date(' Y-m-d h:i:s ',Strtotime("$dt+1day "));//Specify time stamp + 1 days 2017-01-10 21:10:16Echo Date(' Y-m-d h:i:s ',Strtotime("$dt+1year "));//Specify time stamp + 1 year 2018-01-09 21:10:16/*Method Three*///$t is the time stamp specifiedEcho Date(' Y-m-d h:i:s ',Strtotime("+1day",$t));//Specify time stamp + 1 days 2017-01-10 21:10:16Echo Date(' Y-m-d h:i:s ',Strtotime("+1year",$t));//Specify timestamp +1 2018-01-09 21:10:16//specified time stamp plus January, 1 weeks, 1 hours, 1 minutes, 1 seconds principle Ibid.
PHP specifies timestamp/date plus day, year, week, January