Calculates the difference between two given dates in number of days. The return code indicates if the format of the dates or the dates themselves are valid (Y or N). The sign of the calculated value may also be returned.
Valid Date Formats
For the first and the third argument, the INTEGER and FLOAT field cannot be used.
The DATE field can be used, but it should first be converted into string using the .AsNumber Intrinsic Function.
The value of the second and the fourth argument must be in sync with the format that is put into the intrinsic function.
For example, if you have a DATE field called DATEFL1, and want to use it in the BIF as the first argument, you must do a conversion like this:
DATEFL1.AsNumber(DDMMCCYY) (Refer to the Intrinsic Function for other formats.)
In this example, the value of the second argument should be H, which indicates the DDMMYYYY date format.
To hold the first return value, any NUMERIC field can be used including INTEGER and FLOAT.
Example RDMLX only:
USE BUILTIN(DATEDIFFERENCE_ALPHA) WITH_ARGS(#DATEFL1. AsNumber(DDMMCCYY) H #DATFL2. AsNumber (CCYYMMDD) J)TO_GET(#DEC80 )
Note: All dates must have a four character year so that accurate comparisons and calculations can be performed. Where a two character year (e.g. DDMMYY, YYMMDD, MMYY) is supplied the century value is retrieved from the system definition data area. The year supplied is compared to a year in the data area, if the supplied year is less than or equal to the comparison year then the less than century is used. If the supplied year is greater than the comparison year then the greater than century is used.
Calculate the difference #DIFF in days between date field #YMD in date format YYMMDD (D) and date field #DMY in date format DDMMYY (B):
USE BUILTIN(DATEDIFFERENCE_ALPHA) WITH_ARGS(#YMD D #DMY B)