FDATE (The GNU Fortran Compiler)

### 8.111 `FDATE` — Get the current time as a string ¶

Synopsis:

  `CALL FDATE(DATE)`.
  `DATE = FDATE()`.

Description:

  `FDATE(DATE)` returns the current date (using the same format as `CTIME` — Convert a time into a string) in DATE. It is equivalent to `CALL CTIME(DATE, TIME())`.

  This intrinsic is provided in both subroutine and function forms; however, only one form can be used in any given program unit.

Class:

  Subroutine, function

Arguments:

  DATE | The type shall be of type `CHARACTER` of the default kind. It is an `INTENT(OUT)` argument. If the length of this variable is too short for the date and time string to fit completely, it is blank on procedure return.

Return value:

  The current date and time as a string.

Example:

      program test_fdate
          integer(8) :: i, j
          character(len=30) :: date
          call fdate(date)
          print *, 'Program started on ', date
          do i = 1, 100000000 ! Just a delay
              j = i * i - i
          end do
          call fdate(date)
          print *, 'Program ended on ', date
      end program test_fdate

Standard:

  GNU extension

See also:

  `DATE_AND_TIME` — Date and time subroutine,
  `CTIME` — Convert a time into a string