Why is this MySQL query not working?

Go To StackoverFlow.com

2

What's wrong with these two queries?

SELECT (DATE_ADD('2008-11-31',INTERVAL 365 DAY) + INTERVAL 0 DAY) as occursOn
Result:
(
    [0] => Array
        (
            [occursOn] => 
        )

)

And:

SELECT (DATE_ADD('2008-11-31',INTERVAL 730 DAY) + INTERVAL 0 DAY) as occursOn
Result:
(
    [0] => Array
        (
            [occursOn] => 
        )

)

As you can see, the returned value of occursOn is blank each time.

These queries are being generated dynamically, therefore the second +INTERVAL 0 DAY is needed and can't be eliminated.

2009-06-16 09:14
by Click Upvote


5

2008-11-31 not valid date only 30 days in 11th month (November)

2009-06-16 09:22
by Haim Evgi
Ahhh .. - Click Upvote 2009-06-16 09:23


10

Probably because November has 30 days?

2009-06-16 09:21
by Quassnoi
Clear as a bell, +1 - Ivar 2009-06-16 09:24
Ads