Re: Date Math

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20 April 2010 17:40, Floyd Resler <fresler@xxxxxxxxxxxxx> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux