The INTEGER_OF_DATE function converts a date in the Gregorian calendar from standard date form (YYYYMMDD) to integer date form. The type of this function is integer.
The functionality is identical to the COBOL85 function INTEGER-OF-DATE.
Explanation
The one parameter to this function is a positive integer in the form YYYYMMDD, whose value is obtained from the calculation (YYYY * 10000) + (MM * 100) + DD.
|
In the representation YYYYMMDD, . . . |
Represents . . . |
|
YYYY |
The year in the Gregorian calendar. It must be an integer greater than 1600. |
|
MM |
A month. It must be an integer in the range 1 through 12. |
|
DD |
A day. It must be an integer in the range 1 through 31, provided that it is valid for the specified month and year combination. |
An invalid argument will return a value of 0 (zero).
Example
BEGIN
$ INCLUDE INTL = "*SYMBOL/INTL/ALGOL/PROPERTIES." 10000000 - 89999999
EBCDIC ARRAY OUT[0:100];
EBCDIC ARRAY A[0:20];
POINTER P;
INTEGER YYYYMMDD;
INTEGER IOD;
P := OUT[0];
CURRENT_DATE(A);
YYYYMMDD := INTEGER(A[0],8);
IOD := INTEGER_OF_DATE(YYYYMMDD);
REPLACE P BY "YYYYMMDD=", YYYYMMDD FOR 8 DIGITS,
" INTEGER_OF_DATE=", IOD FOR 8 DIGITS, 0 FOR 1;
DISPLAY(P);
END. If run on July 16, 2012 the program would display:
YYYYMMDD=20120716 INTEGER_OF_DATE=00150312

