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


  • Subject: Calculating number of full months between dates
  • From: Tyra_Brodsky@xxxxxxx
  • Date: Wed, 6 Jun 2001 09:12:31 -0700


To all that tried to help me:

Thank you.  While none of the ideas gave me exactly what I was looking for,
they did help me solve my problem.

Here is what I finally came up with

0025.00 C                   If        DateInDay >= 29
0026.00 C                   Z-Add     28            DateInDay
0027.00 C                   EndIf
0028.00  * change the day portion of the UDATE to be the same as DateInDay
0029.00 C                   MoveL     *Year         Work6
0030.00 C                   Move      *Month        Work6
0031.00 C                   Move      DateInDay     Work8
0032.00 C                   MoveL     Work6         Work8
0033.00 C     *ISO     Move      Work8         Date
0034.00  * calculate the duration (this will give months rounded down)
0035.00 C     DateIn        SubDur    Date          ReturnMonth:*M
0036.00 C                   If        SaveDayIn > 28  and
0037.00 C                             *Day < 28
0038.00 C                   Eval      ReturnMonth = ReturnMonth - 1
0039.00 C                   EndIf
0040.00  * if current month and year, ReturnMonth is always 0




+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.