How can we know the number of days between two given dates using PHP?

Last updated 3 years, 2 months ago | 520 views 75     5

Tags:- PHP

Bellow code is used for the same

$date1 = date(‘Y-m-d’);
$date2 = ‘2006-08-15’;
$days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24);
echo $days;