DATE can be used as an intrinsic subroutine or as a portability function or subroutine. It is an intrinsic procedure unless you specify USE IFPORT.
The two-digit year return value may cause problems with the year 2000. Use DATE_AND_TIME instead.
Intrinsic Subroutine: Returns the current date as set within the system.
Syntax
CALL DATE (buf)
buf
Is a 9-byte variable, array, array element, or character substring.
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.
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.
Portability Function or Subroutine: Returns the current system date.
Module: USE IFPORT
Function Syntax:
result = DATE( )
Subroutine Syntax:
CALL DATE (string)
string
(Output) CHARACTER. Variable or array containing at least nine bytes of storage.
DATE in its function form returns a CHARACTER string of length 8 in the form mm/dd/yy, where mm, dd, and yy are two-digit representations of the month, day, and year, respectively.
DATE in its subroutine form returns string in the form dd-mmm-yy, where dd is a two-digit representation of the current day of the month, mmm is a three-character abbreviation for the current month (for example, Jan) and yy are the last two digits of the current year.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
Example
USE IFPORT
!If today's date is March 02, 2000, the following
!code prints "02-Mar-00"
CHARACTER(9) TODAY
CALL DATE(TODAY)
PRINT *, TODAY
!The next line prints "03/02/00"
PRINT *, DATE( )