[UPHPU] mysql date calculation bug

Roberto Mello roberto.mello at gmail.com
Mon Oct 15 15:53:02 MDT 2007


On 10/15/07, Jim Anderson <jim.anderson at techiegroup.com> wrote:
>
> SELECT DATE_SUB(DATE_SUB(CURDATE(), INTERVAL 44 DAY), INTERVAL 6 MONTH);

Just a suggestion related to the question...

Try to use standard SQL if possible. Might help you in the future. I'm
using two different standard forms for intervals here, plus the
CURRENT_DATE standard SQL.

SELECT (current_date - CAST('44 Days' as interval)) - interval '6 months'

Looks cleaner to me, and it's not MySQL-specific.

-Roberto


More information about the UPHPU mailing list