Start of change

FORMATTED-DATE

The FORMATTED-DATE function converts a date from its integer date form to the requested format.

The function type depends on the type of argument-1 as follows:
Table 1. FORMATTED-DATE function type depending on the argument-1 types
argument-1 type Function type
Alphanumeric Alphanumeric
National National
UTF-8 UTF-8

Format

Read syntax diagramSkip visual syntax diagramFUNCTION FORMATTED-DATE (argument-1 argument-2)
argument-1
Must be a national, a UTF-8 or an alphanumeric literal.
The content of argument-1 must be a date format. For details, see Date and time formats.
argument-2
It must be in integer date form. For details, see Integer date form.
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.

The returned value is a representation of the date contained in argument-2 according to the format in argument-1.

Example

Given the date format "YYYYMMDD" and the value "143951", which represents the date 15 February 1995, the returned value would be "19950215".

End of change