Use the %DIFF bif.  The following was extracted from the "ILE RPG
Programmer's Guide"(SC09-2507-05):
========================================================================
- The %DIFF function, for subtracting one date, time, or timestamp value from 
another.

%DIFF(op1:op2:unit)

EVAL  DaysLate = %diff(CurDate:DateDue:*d);

or

/FREE
      DaysLate = %diff(CurDate:DateDue:*d);
/END-FREE

hth,

Frank







"Willie J. Moore" <WJMoore@xxxxxxxxxxxxxxx>@midrange.com on 01/28/2005
03:16:11 PM

Please respond to RPG programming on the AS400 / iSeries
       <rpg400-l@xxxxxxxxxxxx>

Sent by:    rpg400-l-bounces@xxxxxxxxxxxx


To:    <rpg400-l@xxxxxxxxxxxx>
cc:

Subject:    help with comparing two dates


I have to compare two sets of dates/times. One set is start date/time the
other is end date/time. The dates are in (YYYYMMDD) format and the times
are in (oo:oo:oo:) formats.  Each date and time has its on field in the
record.  I want the difference to be in HH:MM.  Our shop still has (using)
RPGIII code. I would to see how this is done in RPG400/ILE. This way I can
start learning it.
Thanks for any and all help.  Examples would be appreciated.
William Moore





This thread ...


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

This mailing list archive is Copyright 1997-2026 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.