the examples in this article summarize issues related to php time calculation. share it with everyone for your reference, the details are as follows:
1. get the date three months ago with php
1 2 3 4 5 6 7 |
|
2. 30 days after the calculation date
you can use strtotime. php provides a super simple way to complete work that would otherwise require dozens of lines of code.
first convert a date into a unix timestamp
1 2 3 |
|
3. convert the timestamps of 2 dates...and then subtract them
1 2 3 4 |
|
4. determine whether it is this week
1 2 3 4 5 6 7 8 9 |
|
readers who are interested in more php-related content can check out the special topics on this site: "php date and time usage summary", "php string (string) usage summary", "complete of php array (array) operation skills", "summary of php network programming skills", "php basic syntax introductory tutorial", "php skills for operating office documents summary (including word, excel, access, ppt)", "php object-oriented programming introductory tutorial", " php mysql database operation introductory tutorial" and "php summary of common database operation skills》
i hope this article will be helpful to everyone in php programming.