C Library Functions  - ordinal_to_date (3)

NAME

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)

CONTENTS

Synopsis
Description
Options
Returns
Example

SYNOPSIS

subroutine ordinal_to_date(yyyy, ddd, dat)

      integer, intent(in)   :: yyyy
      integer, intent(in)   :: ddd
      integer, intent(out)  :: dat

DESCRIPTION

When given a valid year, YYYY, and day of the year, DDD, returns the date as a DAT date array

OPTIONS

yyyy known year
ddd known ordinal day of the year

RETURNS

dat DAT array describing the date

EXAMPLE

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 (3) July 22, 2023
Generated by manServer 1.08 from 90a9e750-c6ea-493b-abff-1b38f7a7bf0e using man macros.