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 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!