31st May 2008 - 2 minutes read time
Use the following function to work out the number of days between today and a date in the future. The function takes three parameters of the day, month and year of the date in question.
<?php
function dateDifference($day, $month, $year)
{
return (int)((mktime (0, 0, 0, $month, $day, $year) - time(void))/86400);
}
?>
To use this function just give it a date, here are some examples.
echo dateDifference(13,07,2008); // 42
echo dateDifference(01,01,2010); // the next "binary date" = 579
echo dateDifference(25,12,2010); // 937