Finding the number of days between two dates

PHP Ferrari picture PHP Ferrari · Jan 11, 2010 · Viewed 845.3k times · Source

How to find number of days between two dates using PHP?

Answer

Adnan picture Adnan · Jan 11, 2010
$now = time(); // or your date as well
$your_date = strtotime("2010-01-31");
$datediff = $now - $your_date;

echo round($datediff / (60 * 60 * 24));