Home > Article > Backend Development > PHP code sharing for date addition and subtraction calculations
PHP standard date format
date("Y-m-d H:i:s");
PHP Simple date addition and subtraction calculation
##1 23456789 1011
12 13 14 |
#
|
Run result:
1 2 3 4 5 6 7 8 9 10 11 |
##Yesterday: 2017-11- 05
|
PHP Advanced Date Addition and Subtraction Calculation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#
|
Run results:
Today: 2017-11-06 18:58:04
Tomorrow: 2017-11-07 18:58:04
2017-11-12 00:00:00
2017-11-07 19:59:04
PHP Advanced Calculation of Date and Time Difference
##1234 56789101112
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
## ## ,0, 4)); ## |
Running results:
1 2 3 4 5 6 7 8 9 10 11 |
##2016-09-13 1473609600 2016-09-12 2019-11-13 2016- 09-13 1473609600 2066-09-12 -> 2016- 09-12 Difference: 18262 days |
Oracle time and date addition and subtraction calculation
The above is the detailed content of PHP code sharing for date addition and subtraction calculations. For more information, please follow other related articles on the PHP Chinese website!