× 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.



If embedded SQL may be an option and you are already on release 6.1 or
higher, you may use the SQL scalar function MONTHS_BETWEEN.
The MONTHS_BETWEEN function returns an estimate of the number of months
Between two expressions (i.e. Date, Timestamp or character string
representing a date or timestamp)
The difference is returned as 31P 15

/Free
Exec SQL Set :MyDiff = Months_Between(:MyDate1, :MyDate2);
/End-Free



Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Ricky Thompson
Gesendet: Thursday, 06. January 2011 15:01
An: rpg400-l@xxxxxxxxxxxx
Betreff: Substract two dates to get the number of months

Is there a way to get the number of months in a numeric value with decimal
values? So if it 1.6 months between two dates. I'm trying to mimic
something someone is doing in Crystal Reports and it returns a partial
month. This is what I'm currently using.


DateDiff = %diff(Date1 : Date2 : *Months);
Ricky Thompson
AS/400 Programmer

Qualitest/Vintage Pharmaceuticals
120,130, 150 Vintage Drive
Huntsville, AL 35811 USA
Phone: +1 256-859-4011 x7191 Direct Line: +1 256-799-7191
rthompson@xxxxxxxxxxxxxxx
"This e-mail, and any attachments, may contain confidential, and/or legally
privileged information, and is intended solely for the use only of the named
addressee(s). If you have received this e-mail in error, please notify the
sender immediately, and permanently delete the original and any copies of
this e-mail, and any attachments, without printing, reading or copying them.
Any use, distribution, or copying of this e-mail other than by the intended
recipient is strictly prohibited. QUALITEST accepts no liability for the
content of this email, or for the consequences of any actions taken on the
basis of the information provided. The recipient should check this e-mail
and any attachments. QUALITEST accepts no liability for damage caused by any
malicious code potentially transmitted by this e-mail."


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.