8.86 CTIME — Convert a time into a string

Synopsis:
CALL CTIME(TIME, RESULT).
RESULT = CTIME(TIME).
Description:

CTIME converts a system time value, such as returned by TIME8 — Time function (64-bit), to a string. The output is of the form ‘Sat Aug 19 18:13:14 1995’.

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:
TIMEThe type shall be of type INTEGER.
RESULTThe type shall be of type CHARACTER and of default kind. It is an INTENT(OUT) argument. If the length of this variable is too short for the time and date string to fit completely, it is blank on procedure return.
Return value:

The converted date and time as a string.

Example:
program test_ctime
    integer(8) :: i
    character(len=30) :: date
    i = time8()

    ! Do something, main part of the program
    
    call ctime(i,date)
    print *, 'Program was started on ', date
end program test_ctime
Standard:

GNU extension

See also:

DATE_AND_TIME — Date and time subroutine,
GMTIME — Convert time to GMT info,
LTIME — Convert time to local time info,
TIME — Time function,
TIME8 — Time function (64-bit)