addmonth problem
Kenneth Brody
kenbrody at bestweb.net
Tue Apr 29 10:53:16 PDT 2008
Quoting Richard Kreiss (Tue, 29 Apr 2008 13:36:52 -0400):
> Not sure if this a bug or a programming error.
>
> I have a routine which creates a number of records based on dates. The date
> is the last day of the month and I use addmonth to get the next months date.
>
> Nd=addmonth(td)
>
> Now this has worked just fine for the last 2 years. He is the problem, this
> year is a leap year and when the program went to create the April record
> with td(10,mdyy/)="02/29/2008" the result is
>
> Nd=addmonth(td) and nd is 04/29/2008.
No, it's not. The result is "03/29/2008", just as it should.
> Now, I would have expected that date
> to be 04/30/2008
Why?
> as 02/28/2007 yielded 04/30/2007.
No, it doesn't. The result is "03/28/2007".
> Now each succeeding month is the 29th and not the last day of the month.
That is correct. One month from February 29 is March 29.
> Now I could just do nd=eom(addmonth(td)) to insure the last day of the
> month.
If you want the last day of the month, then you need to use EOM() to force
the end-of-month date.
> But this appear to be a bug in that addmonth is not taking into account feb
> 29th and correcting April's date to the 30th as it does with Feb. 28th.
No bug here, nor does it "correct" anything with February 28.
> Has this affected anyone else?
--
Read the truth behind the movie "Expelled" at <http://www.ExpelledExposed.com>
--
KenBrody at BestWeb dot net spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com
More information about the Filepro-list
mailing list