Work Out The Number Of Days Before A Date

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.

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


Add new comment

The content of this field is kept private and will not be shown publicly.
2 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.