addmonth problem
Kenneth Brody
kenbrody at bestweb.net
Tue Apr 29 13:21:42 PDT 2008
Quoting GCC Consulting (Tue, 29 Apr 2008 15:58:52 -0400):
> Ken,
>
> If one is adding one month to the last date in February, depending on if it
> is a leap year, one will get either mar 28th or mar 29th.
No, if one adds a month to Feb 28, you get Mar 28, and if you add a month
to Feb 29, you get Mar 29. There is no "this date just happens to be the
last day of the month, so one month later should really be the last day of
that month" exception. Nor, do I believe, should there be such an exception.
> Strictly speaking this is correct. But some may expect the date to be the
> last day of March as this would be the next end of month date.
Why would one expect one month after the last day of February to be the
last day of March, when you wouldn't expect one month after the next-to-
last day of February be the next-to-last day of March?
> So, addmonth() will add 30 days or 31 days.
No, it will add one month.
> What are the parameters? If I
> add a month from the July 31st I would expect to get Aug 31st not Aug 30th.
And that's just what you will get -- Aug 31.
> Again, EOM(addmonth()) will insure the proper date is reached.
That is because you don't want "one month later", you want "the last day
of the following month", which is not the same thing.
> One can also apply dow() to see if the date is a week-end and adjust it if
> necessary to a business date.
If you want the "last business day of the month", then you need to add
logic to determine what you mean by "last business day of the month".
--
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