Intel® Fortran Compiler 16.0 User and Reference Guide

GETDAT

Portability Subroutine: Returns the date.

Module

USE IFPORT

CALL GETDAT (iyr, imon, iday)

iyr

(Output) INTEGER(4) or INTEGER(2). Year ( xxxxAD).

imon

(Output) INTEGER(4) or INTEGER(2). Month (1-12).

iday

(Output) INTEGER(4) or INTEGER(2). Day of the month (1-31).

This subroutine is thread-safe.

All arguments must be of the same integer kind, that is, all must be INTEGER(2) or all must be INTEGER(4).

If INTEGER(2) arguments are passed, you must specify USE IFPORT.

Example

! Program to demonstrate GETDAT and GETTIM
USE IFPORT
INTEGER(4) tmpday, tmpmonth, tmpyear
INTEGER(4) tmphour, tmpminute, tmpsecond, tmphund
CHARACTER(1) mer
CALL GETDAT(tmpyear, tmpmonth, tmpday)
CALL GETTIM(tmphour, tmpminute, tmpsecond, tmphund)
IF (tmphour .GT. 12) THEN
  mer = 'p'
  tmphour = tmphour - 12
ELSE
  mer = 'a'
END IF
WRITE (*, 900) tmpmonth, tmpday, tmpyear
900  FORMAT(I2, '/', I2.2, '/', I4.4)
WRITE (*, 901) tmphour, tmpminute, tmpsecond, tmphund, mer
901  FORMAT(I2, ':', I2.2, ':', I2.2, ':', I2.2, ' ',&
            A, 'm')
END

See Also