Php calculates the number of days to the specified date. Php calculates the number of days to the specified date. This article describes how many days to calculate the number of days to the specified date in php. Share it with you for your reference. The details are as follows: 12345 php calculates the number of days to the specified date
This example describes how many days php calculates to the specified date. Share it with you for your reference. The details are as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
Function countdays ($ d) { $ Olddate = substr ($ d, 4 ); $ Newdate = date (Y). "". $ olddate; $ Nextyear = date (Y) + 1. "". $ olddate; If ($ newdate> date ("Y-m-d ")) { $ Start_ts = strtotime ($ newdate ); $ End_ts = strtotime (date ("Y-m-d ")); $ Diff = $ end_ts-$ start_ts; $ N = round ($ diff/86400 ); $ Return = substr ($ n, 1 ); Return $ return; } Else { $ Start_ts = strtotime ($ nextyear ); $ End_ts = strtotime (date ("Y-m-d ")); $ Diff = $ end_ts-$ start_ts; $ N = round ($ diff/86400 ); $ Return = substr ($ n, 1 ); Return $ return; } } |
The example in this article describes how many days php calculates to the specified date. Share it with you for your reference. Details: 1 2 3 4 5...