How to Find the No Of Days Between Two Dates in PHP


These following code show the no of days between the two dates. Example if you give starting date is 01/01/2009 and ending date is 01/03/2009 it calculate there no of days between these two date .Here the result is 60 days. There code is
$start = mktime(0, 0, 0, $fm, $fd, $fy);
$end = mktime(0, 0, 0, $em, $ed, $ey);

$days = (($end - $start)/(60*60*24)) + 1;

echo "No of days between two date ".$days."

fm indicate the first month fd is the first date fy is the first year
em end month ed is end date and ey is end year.
$start indicate the starting date
$end indicate the end date
In these format has like month date and year

How to find no of days between two dates  php

No comments:
Write comments