> I don't see how the behavior of DATE_ADD(..., INTERVAL 1 MONTH) differs
> from what you want. If you start with 1999-01-14 and you add a month,
> you'll get 1999-02-14. If you start with 1999-01-29 and you add a
> month, you'll get 1999-02-28. Isn't that exactly what you desire? If
> you can show an example of where DATE_ADD doesn't do what you want, it
> would help clear things up a lot!
>
> Tim
Thanks to Thimble Smith for his reply.
Let me try and explain this again...
The Plan:-
1) The "Start" date is the 29th, 30th or 31st.
2) I DATE_ADD 1 month and the date truncates back to the allowable date.
(Great!).
3) The next month I want the "Due" date to return to the original "Start"
day (where possible)
but in the new "Due" month.
An Example:-
1) 1999-01-31 plus 1 month.
2) I somehow set the "Due" day back to the original "Start" day and it
truncates back
to the allowable day. (Fine).
3) We now have 1999-02-28. I add 1 month to this and use some magic routine
to replace the
day with the original "Start" day.
4) We would now have 1999-03-31 (Original day restored). If it was April
MySQL would pull
the date back to the 30th.
As you can see all I really need to do is restore the original day in the
months that allow it and
have MySQL pull it back to a valid date in months that don't.
John.