Php calculates the number of days for different dates. Php calculates the number of days for different dates. This document describes how to calculate the number of days for different dates in php. Share it with you for your reference. Implementation Method: php calculates the number of days for different dates, and php calculates the number of days for different dates.
This example describes how php calculates the number of days for two different dates. Share it with you for your reference. The specific implementation method is as follows:
<? Php/*** calculate the number of days between two dates * (the Taylor formula can be used before the calculation after January 1, January 1, 1970) * @ param string $ day1 * @ param string $ day2 * @ return number */function diffBetweenTwoDays ($ day1, $ day2) {$ second1 = strtotime ($ day1 ); $ second2 = strtotime ($ day2); if ($ second1 <$ second2) {$ tmp = $ second2; $ second2 = $ second1; $ second1 = $ tmp ;} return ($ second1-$ second2)/86400;} $ day1 = "2013-07-27"; $ day2 = "2013-08-04"; $ diff = diffBetweenTwoDays ($ day1, $ day2 ); echo $ diff. "\ n ";
I hope this article will help you with php programming.
Examples in this article describes how php calculates the number of days for two different dates. Share it with you for your reference. Implementation method...