Find number of days between two dates PHP

Last updated on November 16th, 2015 at 09:58 am

Click to rate this tutorial!
[Total: 1 Average: 5]

A simple script for this New Year . This php script will help us find the number of days between two dates. You can give date manually or pass dynamically.

//$start = strtotime('2012-12-31');
$start = time();
$end = strtotime('2013-01-03');
$days_between = ceil(($end - $start) / 86400);
echo $days_between;

Here i have given time() as the start variable. Also commented out one section with
//$start = strtotime(‘2012-12-31’);
You can use either one of those according to your convenience.

Click to rate this tutorial!
[Total: 1 Average: 5]

Leave a Reply

Your email address will not be published.