With the date and time callable services, you can get the current local time and date in several formats and convert dates and times.
The available date and time callable services are shown below. Two of the services, CEEQCEN and CEESCEN, provide a predictable way to handle two-digit years, such as 91 for 1991 or 08 for 2008.
| Callable service | Description |
|---|---|
| CEECBLDY (CEECBLDY—convert date to COBOL integer format) | Converts character date value to COBOL integer date format. Day one is 01 January 1601 and the value is incremented by one for each subsequent day. |
| CEEDATE (CEEDATE—convert Lilian date to character format) | Converts dates in the Lilian format back to character values. |
| CEEDATM (CEEDATM—convert seconds to character timestamp) | Converts number of seconds to character timestamp. |
| CEEDAYS (CEEDAYS—convert date to Lilian format) | Converts character date values to the Lilian format. Day one is 15 October 1582 and the value is incremented by one for each subsequent day. |
| CEEDYWK (CEEDYWK—calculate day of week from Lilian date) | Provides day of week calculation. |
| CEEGMT (CEEGMT—get current Greenwich Mean Time) | Gets current Greenwich Mean Time (date and time). |
| CEEGMTO (CEEGMTO—get offset from Greenwich Mean Time to local time) | Gets difference between Greenwich Mean Time and local time. |
| CEEISEC (CEEISEC—convert integers to seconds) | Converts binary year, month, day, hour, second, and millisecond to a number representing the number of seconds since 00:00:00 15 October 1582. |
| CEELOCT (CEELOCT—get current local date or time) | Gets current date and time. |
| CEEQCEN (CEEQCEN—query the century window) | Queries the callable services century window. |
| CEESCEN (CEESCEN—set the century window) | Sets the callable services century window. |
| CEESECI (CEESECI—convert seconds to integers) | Converts a number representing the number of seconds since 00:00:00 15 October 1582 to seven separate binary integers representing year, month, day, hour, minute, second, and millisecond. |
| CEESECS (CEESECS—convert timestamp to seconds) | Converts character timestamps (a date and time) to the number of seconds since 00:00:00 15 October 1582. |
| CEEUTC (CEEUTC—get coordinated universal time) | Same as CEEGMT. |
| IGZEDT4 (IGZEDT4—get current date) | Returns the current date with a four-digit year in the form YYYMMDD. |
All of these date and time callable services allow source code compatibility with Enterprise COBOL for z/OS. There are, however, significant differences in the way conditions are handled.
The date and time callable services are in addition to the date/time intrinsic functions shown below.
| Intrinsic function | Description |
|---|---|
| CURRENT-DATE | Current date and time and difference from Greenwich mean time |
| DATE-OF-INTEGER1 | Standard date equivalent (YYYYMMDD) of integer date |
| DATE-TO-YYYYMMDD1 | Standard date equivalent (YYYYMMDD) of integer date with a windowed year, according to the specified 100-year interval |
| DATEVAL1 | Date field equivalent of integer or alphanumeric date |
| DAY-OF-INTEGER1 | Julian date equivalent (YYYYDDD) of integer date |
| DAY-TO-YYYYDDD1 | Julian date equivalent (YYYYMMDD) of integer date with a windowed year, according to the specified 100-year interval |
| INTEGER-OF-DATE | Integer date equivalent of standard date (YYYYMMDD) |
| INTEGER-OF-DAY | Integer date equivalent of Julian date (YYYYDDD) |
| UNDATE1 | Nondate equivalent of integer or alphanumeric date field |
| YEAR-TO-YYYY1 | Expanded year equivalent (YYYY) of windowed year, according to the specified 100-year interval |
| YEARWINDOW1 | Starting year of the century window specified by the YEARWINDOW compiler option |
|
|
Example: formatting dates for output
related references
Feedback token
CALL statement
(COBOL for Windows Language Reference)
Function definitions
(COBOL for Windows Language Reference)