DATE_AND_TIME(3F)
NAME
date_and_time − Returns date and time in character form
SYNOPSIS
subroutine date_and_time (date, time, zone, values)
character∗8 date
character∗10 time
character∗5 zone
integer∗4 values(8)
DESCRIPTION
This is a Fortran 77 version of the Fortran 90 routine DATE_AND_TIME and is YEAR 2000 SAFE.
The DATE_AND_TIME subroutine returns data from the real-time clock and the date. Local time is returned, as well as the difference between local time and Universal Coordinated Time (UTC) (also known as Greenwich Mean Time, GMT).
The DATE_AND_TIME subroutine accepts the following arguments:
date Must be a scalar of type character. It must be at least 8 characters long to contain the complete value. It is an output argument, and the leftmost 8 characters are set to a value of the form CCYYMMDD, where CC is the century, YY is the year within the century, MM is the month within the year, and DD is the day within the month. If there is no date available, date is set to blanks.
time Must be a scalar of type character. It must be at least 10 characters long to contain the complete value. It is an output argument, and the leftmost 10 characters are set to a value of the form hhmmss.sss, where hh is the hour of the day, mm is the minutes of the hour, and ss.sss is seconds and milliseconds of the minute. If there is no clock available, time is set to blanks.
zone Must be a scalar of type character. It must be at least 5 characters long to contain the complete value. It is an output argument whose leftmost 5 characters are set to a value of the form ±hhmm, where hh and mm are the time difference with respect to UTC in hours and parts of an hour expressed in minutes, respectively. If there is no clock available, zone is set to blanks. (Note: Local time zone is set by the operating system and/or the TZ environment variable.)
values Must be of type default integer and of rank one. It is an output argument and must have at least 8 elements. The values returned in values are as follows:
Values Return value
values(1) The year (that is, 1990)
values(2) The month of the year (1-12)
values(3) The day of the month (1-31)
values(4) The time difference, in minutes, with respect to UTC
values(5) The hour of the day, in the range of 0 to 23
values(6) The minutes of the hour, in the range 0 to 59
values(7) The seconds of the minute, in the range 0 to 60
values(8) The milliseconds of the second, in the range 0 to 999
EXAMPLES
integer∗4 date_time(8)
character(len=10) big_ben(3)
call date_and_time(big_ben(1), big_ben(2), big_ben(3), date_time)
print ∗,’date_time array values:’
print ∗,’year=’,date_time(1)
print ∗,’month_of_year=’,date_time(2)
print ∗,’day_of_month=’,date_time(3)
print ∗,’time difference in minutes=’,date_time(4)
print ∗,’hour of day=’,date_time(5)
print ∗,’minutes of hour=’,date_time(6)
print ∗,’seconds of minute=’,date_time(7)
print ∗,’milliseconds of second=’,date_time(8)
print ∗, ’DATE=’,big_ben(1)
print ∗, ’TIME=’,big_ben(2)
print ∗, ’ZONE=’,big_ben(3)
end
When this program was run in California, USA, on October 10, 1997, it generated the following output:
date_time array values:
year= 1997
month_of_year= 10
day_of_month= 10
time difference in minutes= -420
hour of day= 16
minutes of hour= 35
seconds of minute= 37
milliseconds of second= 708
DATE=19971010
TIME=163537.708
ZONE=-0700
FILES
libF77.a
SEE ALSO
idate(3f), ctime(3F), fdate(3F), and the FORTRAN 77 Language Reference Manual
SunOS 5.0 — Last change: 98/09/16