Count Days Between Dates

Description: Find how many days there are between two given dates.

<?PHP
 
// First Date: 1 January 2005
// Second Date: 27 January 2005
 
$first_date = MKTIME(12,0,0,1,1,2005);
$second_date = MKTIME(12,0,0,1,27,2005);
 
$offset = $second_date-$first_date;
 
ECHO FLOOR($offset/60/60/24) . " days";
 
// This will display: 26 days.
 
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.