
https://www.ibm.com/docs/en/cobol-zos/6.3.0?topic=functions-current-date

CURRENT-DATE
Last Updated: 2025-02-03

The CURRENT-DATE function returns a 21-character alphanumeric value that represents the calendar date, time of day, and time differential from Greenwich mean time provided by the system on which the function is evaluated.

The function type is alphanumeric.
Format
Read syntax diagramSkip visual syntax diagramFUNCTION CURRENT-DATE

Reading from left to right, the 21 character positions of the returned value are as follows:

Character positions
	
Contents
1-4 	Four numeric digits of the year in the Gregorian calendar
5-6 	Two numeric digits of the month of the year, in the range 01 through 12
7-8 	Two numeric digits of the day of the month, in the range 01 through 31
9-10 	Two numeric digits of the hours past midnight, in the range 00 through 23
11-12 	Two numeric digits of the minutes past the hour, in the range 00 through 59
13-14 	Two numeric digits of the seconds past the minute, in the range 00 through 59
15-16 	Two numeric digits of the hundredths of a second past the second, in the range 00 through 99. The value 00 is returned if the system on which the function is evaluated does not have the facility to provide the fractional part of a second.
17 	Either the character '-' or the character '+'. The character '-' is returned if the local time indicated in the previous character positions is behind Greenwich mean time. The character '+' is returned if the local time indicated is the same as or ahead of Greenwich mean time. The character '0' is returned if the system on which this function is evaluated does not have the facility to provide the local time differential factor.
18-19 	If character position 17 is '-', two numeric digits are returned in the range 00 through 12 indicating the number of hours that the reported time is behind Greenwich mean time. If character position 17 is '+', two numeric digits are returned in the range 00 through 13 indicating the number of hours that the reported time is ahead of Greenwich mean time. If character position 17 is '0', the value 00 is returned.
20-21 	Two numeric digits are returned in the range 00 through 59 indicating the number of additional minutes that the reported time is ahead of or behind Greenwich mean time, depending on whether character position 17 is '+' or '-', respectively. If character position 17 is '0', the value 00 is returned.
Example

Given the current z/OS® operating environment timestamp is "1995-02-15 05:14:27.812479168304" Eastern Standard Time, FUNCTION CURRENT-DATE returns a 21-character alphanumeric field that can be used as follows:

WORKING-STORAGE SECTION.
01  WS-CURRENT-DATE-FIELDS.
    05  WS-CURRENT-DATE.
        10  WS-CURRENT-YEAR    PIC  9(4).
        10  WS-CURRENT-MONTH   PIC  9(2).
        10  WS-CURRENT-DAY     PIC  9(2).
    05  WS-CURRENT-TIME.
        10  WS-CURRENT-HOUR    PIC  9(2).
        10  WS-CURRENT-MINUTE  PIC  9(2).
        10  WS-CURRENT-SECOND  PIC  9(2).
        10  WS-CURRENT-MS      PIC  9(2).
    05  WS-DIFF-FROM-GMT       PIC S9(4).
PROCEDURE DIVISION.
    MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-FIELDS

WS-CURRENT-DATE-FIELDS contains "1995021505142781-0500".
