The strtotime php function is used to parse any English textual datetime description into a Unix timestamp. This function will use the TZ environment variable (if available) to calculate the timestamp. It returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure.
$date1 = date(‘Y-m-d’);
$date2 = ‘2005-03-01′;
$days = (strtotime() – strtotime()) / (60 * 60 * 24);
echo “Number of days since ‘2005-03-01′: $days”;
View Comments
$date = date('y-m-d');
$date2 = '2010-11-08';
$days = (strtotime($date) - strtotime($date2)) / (60*60*24);