Well you could do two str2time() calls like this:

# Two Dates to Compare #
$date1 = strtotime("Oct 18, 2002");
$date2 = strtotime("Jan 18, 2002");

# Assign the earliest date and laterdate to variables #
$earlyDate = ($date1 < $date2) ? $date1 : $date2;
$laterDate = ($earlyDate == $date1) ? $date2 : $date1;

# Computes to find how many days are between the two dates #
$daysBetween = ceil(($laterDate - $earlyDate)/(60*60*24));
echo $daysBetween;

There's probably an easier way of doing this, but hey it works! ;)

Rick

You will never be happy if you continue to search for what happiness
consists of. You will never live if you are looking for the meaning of life.
- Albert Camus

> From: "Josh Edwards" <[EMAIL PROTECTED]>
> Date: Sun, 19 May 2002 10:22:28 +1000
> To: [EMAIL PROTECTED]
> Subject: [PHP] date functions
> 
> Does anyone know  a good way to count the days between two dates. ie how
> many Mondays fall between two dates. As a starting  point I have calculated
> the start and end dates and the no of days b/w them.
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to