INTEGER-OF-FORMATTED-DATE

The INTEGER-OF-FORMATTED-DATE function converts a date that is in a specified format to an integer date form.

The function type is integer.

Format

Read syntax diagramSkip visual syntax diagram FUNCTION INTEGER-OF-FORMATTED-DATE ( argument-1 argument-2 )
argument-1
Must be a national, UTF-8, or an alphanumeric literal in either a date format or a combined date and time format. For details, see Date and time formats.
argument-2
Must be a data item of the same class as argument-1.
If argument-1 is a date format, the content of argument-2 should be a valid date in that format.
If argument-1 is a combined date and time format, the content of argument-2 should be a valid combined date and time in that format.

Returned values

The returned value is in the integer date form equivalent of the date represented by argument-2 when analyzed according to argument-1. A value in integer date form is a positive integer that represents a number of days succeeding 31 December, 1600 in the Gregorian calendar. It is based on a starting date of Monday, 1 January, 1601 and integer date 1 represents Monday, 1 January, 1601.

The INTDATE compiler option affects the starting date for the integer date functions. For details, see INTDATE in the Enterprise COBOL Programming Guide.

Note: If argument-1 contains a combined date and time format, the time portion of argument-2 is validated against the format in argument-1, but the returned value will not be impacted by the validated result.

Example

If the format of the first argument is "YYYYMMDD" and the value for the second argument is "19950215", the returned value would be 143951. The same value would be returned if the format of the first argument is "YYYYMMDDThhmmss.ss+hhmm" and the value for the second argument is "19950215T05142781+0500".