Php calculates the number of days to the specified date, which is the php date. Php calculates the number of days to the specified date. The php date example in this article describes how many days php calculates the number of days to the specified date. Share it with you for your reference. The details are as follows: 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:
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 will help you with php programming.
The example in this article describes how many days php calculates to the specified date. Share it with you for your reference. Details :...