List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:October 7 1999 8:09pm
Subject:Re: Can I rely on date_add to land on a valid date.
View as plain text  
At 21:03, 19991007, John Hennessy wrote:
>> Examples demonstrate this easily:
>>  DATE_ADD('1999-01-31', INTERVAL  1 MONTH) ==> 1999-02-28
>>  DATE_ADD('1999-01-31', INTERVAL  3 MONTH) ==> 1999-04-30
>>  DATE_ADD('1999-01-31', INTERVAL  6 MONTH) ==> 1999-07-31
>>  DATE_ADD('1999-01-31', INTERVAL 12 MONTH) ==> 2000-01-31
>
>What I am trying to achieve is same day calendar month billing where
>possible and last day of the month where it is not.

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
Thread
Can I rely on date_add to land on a valid date.John Hennessy7 Oct
  • Re: Can I rely on date_add to land on a valid date.Thimble Smith7 Oct
  • Re: Can I rely on date_add to land on a valid date.John Hennessy8 Oct
    • Re: Can I rely on date_add to land on a valid date.Thimble Smith8 Oct
    • Re: Can I rely on date_add to land on a valid date.Martin Ramsch8 Oct
      • Question about Random OrderFraser MacKenzie8 Oct
        • Re: Question about Random OrderMartin Ramsch8 Oct