DATE_AND_TIME
— Date and time subroutine ¶DATE_AND_TIME(DATE, TIME, ZONE, VALUES)
gets the corresponding date and
time information from the real-time system clock. DATE is
INTENT(OUT)
and of the form ccyymmdd. TIME is INTENT(OUT)
and of the form hhmmss.sss. ZONE is INTENT(OUT)
and of the form
(+-)hhmm, representing the difference with respect to Coordinated Universal
Time (UTC). Unavailable time and date parameters return blanks.
VALUES is INTENT(OUT)
and provides the following:
VALUES(1) : | The year, including the century |
VALUES(2) : | The month of the year |
VALUES(3) : | The day of the month |
VALUES(4) : | The time difference from UTC in minutes |
VALUES(5) : | The hour of the day |
VALUES(6) : | The minutes of the hour |
VALUES(7) : | The seconds of the minute |
VALUES(8) : | The milliseconds of the second |
Fortran 90 and later
Subroutine
CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])
DATE | (Optional) Scalar of type default CHARACTER .
Recommended length is 8 or larger. |
TIME | (Optional) Scalar of type default CHARACTER .
Recommended length is 10 or larger. |
ZONE | (Optional) Scalar of type default CHARACTER .
Recommended length is 5 or larger. |
VALUES | (Optional) Rank-1 array of type INTEGER with
a decimal exponent range of at least four and array size at least 8. |
None
program test_time_and_date character(8) :: date character(10) :: time character(5) :: zone integer,dimension(8) :: values ! using keyword arguments call date_and_time(date,time,zone,values) call date_and_time(DATE=date,ZONE=zone) call date_and_time(TIME=time) call date_and_time(VALUES=values) print '(a,2x,a,2x,a)', date, time, zone print '(8i5)', values end program test_time_and_date
CPU_TIME
— CPU elapsed time in seconds,
SYSTEM_CLOCK
— Time function