ordinal_to_date(3f) - [M_time:ORDINAL_DAY] when given a valid year and day of the year returns the DAT array for the date (LICENSE:MIT)
Synopsis
Description
Options
Returns
Example
subroutine ordinal_to_date(yyyy, ddd, dat)
integer, intent(in) :: yyyy integer, intent(in) :: ddd integer, intent(out) :: dat
When given a valid year, YYYY, and day of the year, DDD, returns the date as a DAT date array
yyyy known year ddd known ordinal day of the year
dat DAT array describing the date
Sample program:
program demo_ordinal_to_date use M_time, only : ordinal_to_date implicit none integer :: yyyy, ddd, mm, dd, yy integer :: dat(8) integer :: ios INFINITE: do write(*,(a),advance=no)& & Enter year YYYY and ordinal day of year DD read(*,*,iostat=ios)yyyy,ddd if(ios/=0)exit INFINITE ! recover month and day from year and day number. call ordinal_to_date(yyyy, ddd, dat) yy=dat(1) mm=dat(2) dd=dat(3) write(*,(*(g0)))For Year ,yyyy, and Ordinal day ,ddd, & & Month is ,mm, and Day of Month is ,dd, & & and Year is ,yy enddo INFINITE end program demo_ordinal_to_date
Nemo Release 3.1 | ordinal_to_date (3m_time) | August 31, 2024 |