: This article describes how to calculate the time after (before) the current time in PHP. if you are interested in the PHP Tutorial, refer to it. PHP calculates the time after (before) the current time
There is a very powerful function in PHP, strtotime () function. this function has a very bad usage method, which is described in the manual, however, it is estimated that there are not many people to think of in practical applications.
I accidentally discovered this function after I wrote a very complex function to calculate the date of the current N days. now I recorded it so that I could not forget it later.
The timestamp after the current time is one week: strtotime ("+ 1 week"). That's all. after one week, I think you should know it after N weeks, hey ......
Then, what about a month later? It should be strtotime ("+ 1 months ");
Five days later, of course, is: strtotime ("+ 5 days ");
What about 12 hours later? Strtotime ("+ 12 hours ");
20 minutes later, of course: strtotime ("+ 20 minutes ");
30 seconds later is strtotime ("+ 30 seconds ");
What about last Saturday? It should be strtotime ("Last Saturday");
Next Saturday is of course strtotime ("Next Saturday ");
Of course, you can also write it as follows: the current time is one month, two weeks, three days, four hours, 16 minutes, and 32 seconds later:
Date ("Y-m-d H: I: s", strtotime ("+ 1 months + 1 week + 3 days + 4 hours + 16 minutes + 32 seconds "));
The time after the current time is "+". of course, you can use "-" for the previous time!
The above section describes the time (before) after the current PHP computing time, including the relevant content, and hopes to help those who are interested in the PHP Tutorial.