PHP calculates a two-day difference between days, PHP date Difference days
This example describes how PHP calculates the two-day difference between days. Share to everyone for your reference. The implementation method is as follows:
<?php/** * Ask for a difference between two dates * (Taylor formula can be used before January 1, 1970) * @param string $day 1 * @param string $day 2 * @return number */FU Nction Diffbetweentwodays ($day 1, $day 2) { $second 1 = strtotime ($day 1); $second 2 = strtotime ($day 2); if ($second 1 < $second 2) { $tmp = $second 2; $second 2 = $second 1; $second 1 = $tmp; } Return ($second 1-$second 2)/86400;} $day 1 = "2013-07-27"; $day 2 = "2013-08-04"; $diff = Diffbetweentwodays ($day 1, $day 2); Echo $diff. " \ n ";
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/967741.html www.bkjia.com true http://www.bkjia.com/PHPjc/967741.html techarticle PHP calculates the two date difference days method, PHP date difference of days This example describes how PHP calculates the two date difference between days. Share to everyone for your reference. Concrete Implementation Method ...