Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

DATE Intrinsic Procedure

Intrinsic Subroutine (Generic): Returns the current date as set within the system. DATE can be used as an intrinsic subroutine or as a portability routine. It is an intrinsic procedure unless you specify USE IFPORT. Intrinsic subroutines cannot be passed as actual arguments.

CALL DATE (buf)

buf

(Output) Is a variable, array, or array element of any data type, or a character substring. It must contain at least nine bytes of storage.

The date is returned as a 9-byte ASCII character string taking the form dd-mmm-yy, where:

dd

is the 2-digit date

mmm

is the 3-letter month

yy

is the last two digits of the year

If buf is of numeric type and smaller than 9 bytes, data corruption can occur.

If buf is of character type, its associated length is passed to the subroutine. If buf is smaller than 9 bytes, the subroutine truncates the date to fit in the specified length. If an array of type character is passed, the subroutine stores the date in the first array element, using the element length, not the length of the entire array.

CAUTION:

The two-digit year return value may cause problems with the year 2000. Use DATE_AND_TIME instead.

Example

CHARACTER*1 DAY(9)
…
CALL DATE (DAY)

The length of the first array element in CHARACTER array DAY is passed to the DATE subroutine. The subroutine then truncates the date to fit into the 1-character element, producing an incorrect result.