Fortran获得当前的日期和时间,需要使用date_and_time函数!!!
date_and_time 返回实时时钟和日期的相关数据。返回数据包括本地时间以及本地时间与通用协调时间 (Universal Coordinated Time, UTC) 之间的时差,通用协调时间也称为格林威治标准时间 (Greenwich Mean Time, GMT)。


实例:
program now_time
integer date_time(8)
character*10 b(3)
call date_and_time(b(1), b(2), b(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=’,b(1)
print *, ’TIME=’,b(2)
print *, ’ZONE=’,b(3)
end
运行结果为:
date_time array values:
year= 2013
month_of_year= 12
day_of_month= 2
time difference in minutes= 480
hour of day= 17
minutes of hour= 14
seconds of minute= 49
milliseconds of second= 320
DATE=20131202
TIME=171449.320
ZONE=+0800