o2d(3f) - [M_time:ORDINAL_DAY] converts Ordinal day to DAT date-time array (LICENSE:MIT)
Synopsis
Description
Options
Returns
Example
Author
License
function o2d(ordinal,[year]) result(dat)
integer,intent(in) :: ordinal ! the day of the year integer,optional :: year ! year integer :: dat(8) ! date time array
Given an Ordinal day of the year return a date in the form of a "DAT" array.
ordinal The day of the year for the given year, where Jan 1st=1. year An optional year for the ordinal day. If not present the current year is assumed.
dat Integer array holding a "DAT" array, similar in structure to the array returned by the intrinsic DATE_AND_TIME(3f): dat=[ year,month,day,timezone,hour,& & minutes,seconds,milliseconds]The timezone value is from the current time on the current platform.
Sample program:
program demo_o2d use M_time, only : o2d,fmtdate implicit none integer :: year do year=2004,2008 write(*,(*(g0)))& & 100th day of ,year, is ,fmtdate(o2d(100,year)) enddo write(*,(*(g0)))100th day of this year is ,fmtdate(o2d(100)) end program demo_o2dResults:
> 100th day of 2004 is Friday, April 9th, 2004 12:00:00 AM UTC-05:00 > 100th day of 2005 is Sunday, April 10th, 2005 12:00:00 AM UTC-05:00 > 100th day of 2006 is Monday, April 10th, 2006 12:00:00 AM UTC-05:00 > 100th day of 2007 is Tuesday, April 10th, 2007 12:00:00 AM UTC-05:00 > 100th day of 2008 is Wednesday, April 9th, 2008 12:00:00 AM UTC-05:00 > 100th day of this year is Monday, April 10th, 2023 12:00:00 AM UTC-05:00
John S. Urban, 2015
Nemo Release 3.1 | o2d (3) | February 23, 2025 |