Returns two strings containing the date and the time in human-readable format. Uses a standard f90 call.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=9), | intent(out) | :: | cdate | The date |
||
character(len=9), | intent(out) | :: | ctime | The time |
subroutine io_date(cdate, ctime)
!=======================================================
!
!! Returns two strings containing the date and the time
!! in human-readable format. Uses a standard f90 call.
!
!=======================================================
implicit none
character(len=9), intent(out) :: cdate
!! The date
character(len=9), intent(out) :: ctime
!! The time
character(len=3), dimension(12) :: months
data months/'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', &
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'/
integer date_time(8)
!
call date_and_time(values=date_time)
!
write (cdate, '(i2,a3,i4)') date_time(3), months(date_time(2)), date_time(1)
write (ctime, '(i2.2,":",i2.2,":",i2.2)') date_time(5), date_time(6), date_time(7)
end subroutine io_date