The date-and-time system variables let you retrieve the system date and time in a variety of formats, as shown in the next table.
System variable | Description |
---|---|
sysVar.currentDate | Contains the current system date in eight-digit Gregorian format (YYYYMMDD) |
sysVar.currentFormattedDate | Contains the current system date in the system default long Gregorian format |
sysVar.currentFormattedJulianDate | Contains the current system date in the system default long Julian format |
sysVar.currentFormattedTime | Retrieves the current system time in HH:MM:SS format |
sysVar.currentJulianDate | Contains the current system date in seven-digit Julian format (YYYYDDD) |
sysVar.currentShortDate | Contains the current system date in six-digit Gregorian format (YYMMDD) |
sysVar.currentShortJulianDate | Contains the current system date in five-digit Julian format (YYDDD) |
Related reference
System words
System words in alphabetical order
EGL statements
The system variable sysVar.currentDate contains the current system date in eight-digit Gregorian format (YYYYMMDD).
The sysVar.currentDate value is updated automatically before each reference. The value is numeric and contains no separator characters.
You can use sysVar.currentDate as the source in an assignment or move statement or as the argument in a return or exit statement.
The characteristics of sysVar.currentDate are as follows:
myDate = sysVar.currentDate
Related reference
Date and time (system words)
The system variable sysVar.currentFormattedDate contains the current system date in long Gregorian format. The value is automatically updated each time system variable is referenced by your program.
For COBOL programs, the system administrator for EGL run-time services sets the format at installation.
For Java programs, the format is in this Java run-time property:
vgj.datemask.gregorian.long.NLS
For additional details on vgj.nls.code, see Java run-time properties (details).
The format specified in vgj.datemask.gregorian.long.NLS includes DD (for numeric day), MM (for numeric month), and YYYY (for numeric year), with characters other than D, M, Y, or digits used as separators. You can specify the format in the dateMask build descriptor option, and the default format is specific to the locale.
You can use sysVar.currentFormattedDate as the source in an assignment or move statement or as the argument in a return or exit statement.
Make sure that this Gregorian long date format is the same as the date format specified for the SQL database manager. Matching the two formats enables sysVar.currentFormattedDate to produce dates in the format expected by the database manager.
The characteristics of sysVar.currentFormattedDate are as follows:
myDate = sysVar.currentFormattedDate;
Related concepts
Build descriptor part
Java run-time properties
Related tasks
Editing Java run-time properties in a build descriptor
Related reference
Date and time (system words)
Java run-time properties (details)
targetNLS
The system variable sysVar.currentFormattedJulianDate contains the current system date in long Julian format. The value is automatically updated each time the system variable is referenced by your program
For COBOL programs, the system administrator for EGL run-time services sets the format at installation.
For Java programs, the format is in this Java run-time property:
vgj.datemask.julian.long.NLS
For additional details on vgj.nls.code, see Java run-time properties (details).
The format specified in vgj.datemask.julian.long.NLS includes DDD (for numeric day) and YYYY (for numeric year), with characters other than D, Y, or digits used as separators. You can specify the format in the dateMask build descriptor option, and the default format is specific to the locale.
You can use sysVar.currentFormattedJulianDate as the source in an assignment or move statement or as the argument in a return or exit statement.
The characteristics of sysVar.currentFormattedJulianDate are as follows:
myDate = sysVar.currentFormattedJulianDate;
Related concepts
Build descriptor part
Java run-time properties
Related tasks
Editing Java run-time properties in a build descriptor
Related reference
Date and time (system words)
Java run-time properties (details)
targetNLS
The system variable sysVar.currentFormattedTime retrieves the current system time in HH:MM:SS format. The value is automatically updated each time it is referenced by your program.
You can use sysVar.currentFormattedTime in these ways:
The characteristics of sysVar.currentFormattedTime are as follows:
timeField = sysVar.currentFormattedTime;
Related reference
Date and time (system words)
The system variable sysVar.currentJulianDate contains the current system date in seven-digit Julian format (YYYYDDD).
The sysVar.currentJulianDate value is updated automatically before each reference. The value is numeric and contains no separator characters.
You can use sysVar.currentJulianDate as the source in an assignment or move statement or as the argument in a return or exit statement.
The characteristics of sysVar.currentJulianDate are as follows:
myDay = sysVar.currentJulianDate;
Related reference
Date and time (system words)
The system variable sysVar.currentShortDate contains the current system date in six-digit Gregorian format (YYMMDD).
The sysVar.currentShortDate value is automatically updated each time it is referenced by the program. The returned value is numeric and contains no separator characters.
You can use sysVar.currentShortDate as the source in an assignment or move statement or as the argument in a return or exit statement.
The characteristics of sysVar.currentShortDate are as follows:
myDay = sysVar.currentShortDate;
Related reference
Date and time (system words)
The system variable sysVar.currentShortJulianDate contains the current system date in five-digit Julian format (YYDDD). The value is automatically updated each time it is referenced by your program.
The value is numeric and contains no separator characters.
You can use sysVar.currentShortJulianDate as the source in an assignment or move statement or as the argument in a return or exit statement.
The characteristics of sysVar.currentShortJulianDate are as follows:
myDay = sysVar.currentShortJulianDate;
Related reference
Date and time (system words)
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.