How many days do PHP calculate to a specified date, PHP date
This example describes how PHP calculates the number of days to a specified date. Share to everyone for your reference. Specific as follows:
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; }}
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/984004.html www.bkjia.com true http://www.bkjia.com/PHPjc/984004.html techarticle How many days do PHP calculate to a specified date, PHP date This example describes how many days PHP calculates to a specified date. Share to everyone for your reference. Specific as follows: ...