× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Exactly, if you want the end of the month, you should use the
GetEndOfMonth() procedure in RPG xTools, or simply right a short 2 or 3 line
routine to do the same kind of thing.
-Bob


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Douglas Handy
Sent: Monday, March 27, 2006 3:27 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Bug in IBM Date Routies %month

Praveen,

Shouldn't it be 2006-03-31 both the times.


No, it is working as designed.  Refer to the manual for %Months(), which
says in part:

 "In most cases, the result of adding or subtracting a given number of
months is
obvious. For example, 2000-03-15 + %MONTHS(1) is 2000-04-15. If the addition
or
subtraction would produce a nonexistent date (for example, February 30), the
last
day of the month is used instead.

Adding or subtracting a number of months to the 29th, 30th, or 31st day of a
month may not be reversible. For example, 2000-03-31 + %MONTHS(1) -
 %MONTHS(1) is 2000-03-30"

So when you add one month to 1/31, you get 2/28, then add another month and
get 3/28.

Working as designed.

Doug

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.