Get number of days between two given dates in php

To get number of days between two given dates is quite easy in php. Let's look below the code to get number of days between two given dates

<?php


$days = (strtotime(date("Y-m-d"))-strtotime("2009-1-20") ) / (60 * 60 * 24);

//$days_proc_time = (strtotime(date("Y-m-d")) - strtotime("2005-11-20") ) / (60 * 60 * 24);

print $days;

?>

0 comments: