%DIFF built-in function produces the difference (duration) between two date or time values. The first and second parameters must be the same or compatible types.
%DIFF (Op1, Op2, {*MSECONDS | *SECONDS | *MINUTES | *HOURS | *DAYS | *MONTHS | *YEARS})
Required. These two parameters must be the same or compatible types. The following combination are valid:
Required. This specifies the duration. Valid codes depend upon the previous parameters as follows:
The result will be rounded down with any remainder discarded. For example, 61 minutes is equal to 1 hour, and 59 minutes is equal to 0 hours. Visual RPG places an 18-digit limit on durations. A duration with more than 15 significant digits will cause errors or truncation. The value returned by this function is compatible with both type numeric and type duration. You can add or subtract the result to a number (type numeric) or a date, time, or timestamp (type duration). See Adding or Subtracting Dates for more information.
Built-in Function Overview
Date and Time Topics
Adding
or Subtracting Dates
%DAYS
%HOURS
%MINUTES
%MONTHS
%MSECONDS
%SECONDS
%YEARS
ADDDUR
SUBDUR