Re: Date Math

From: Date: Wed, 21 Apr 2010 09:39:56 +0000
Subject: Re: Date Math
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-304286@lists.php.net to get a copy of this message
On 20 April 2010 17:40, Floyd Resler <fresler@adex-intl.com> wrote: > I need to get the difference in months between two dates. The dates could > be as much as 60 months apart. Is there any easy way to do this either > through PHP or MySQL? I know how I can do it through code but thought there > might be a simple one or two line option. > > Thanks! > Floyd > > You're best off doing this in MySQL. Something like select timestampdiff(month, '2010-01-01', '2010-05-22'); should work. Michiel

« previous php.general (#304286) next »