tags:

views:

80

answers:

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.

+9  A: 

Probably because November has 30 days?

Quassnoi
Clear as a bell, +1.
Ivarska
+3  A: 

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

Haim Evgi
Ahhh ...
Click Upvote