Obtaining the Difference Between Two Dates
<?php
$date1 = '14 Jun 2002';
$date2 = '05 Feb 2006';
$ts1 = strtotime($date1);
$ts2 = strtotime($date2);
printf("<p>The difference between %s and %s is %d seconds.<p>\n",
$date1, $date2, $ts2 - $ts1);
?>
Related examples in the same category