Re: Date Math
| From: | Floyd Resler | Date: | Wed, 21 Apr 2010 12:37:00 +0000 |
| Subject: | Re: Date Math | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304307@lists.php.net to get a copy of this message | ||
On Apr 21, 2010, at 5:39 AM, Michiel Sikma wrote:
> 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
Perfect! That's exactly what I was looking for!