> How do I subtract the difference of months between two dates?
>
> For instance, if one date is 2003-12 and the other is 2002-08, I need
to
> know that there are 16 months between them. If one date is 2003-04 and
the
> other is 2003-01, I need to know that there are 3 months between them.
How
> can I do this?
One way...
$date1 = "2003-12";
$date2 = "2002-08";
$d1 = explode('-',$date1);
$d2 = explode('-',$date2);
$diff = ($d1[0]*12+$d1[1]) - ($d2[0]*12+$d2[1]);
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php