ILE COBOL Programmer's Guide


Using Intrinsic Functions or the ACCEPT Statement to Retrieve Current Century

You can also use one of the following intrinsic functions to retrieve the current century or a 4-digit year:

CURRENT-DATE
Returns the current 4-digit year, as well as other information about the current date and time.

DATE-OF-INTEGER
Takes an integer date, the number of days since December 31, 1600, and returns a Gregorian date with a 4-digit year in the form YYYYMMDD.

DAY-OF-INTEGER
Takes an integer date, the number of days since December 31, 1600, and returns a Julian date with a 4-digit year in the form YYYYDDD.

DATE-TO-YYYYMMDD
Converts a 2-digit year Gregorian date to a 4-digit year Gregorian date.

DAY-TO-YYYYDDD
Converts a 2-digit year Julian date to a 4-digit year Julian date.

EXTRACT-DATE-TIME
Extracts a part of the date or time information contained in a date, time or timestamp item. The year is extracted as a 4-digit year or a 1-digit century.

YEAR-TO-YYYY
Converts a 2-digit year to a 4-digit year.

The FROM DATE YYYYMMDD phrase of the ACCEPT statement can be used to retrieve a 4-digit year Gregorian date from the system. The FROM DAY YYYYDDD phrase of the ACCEPT statement can be used to retrieve a 4-digit year Julian date from the system.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]