C Library Functions - o2d (3)
NAME
o2d(3f) - [M_time:ORDINAL_DAY] converts Ordinal day to DAT date-time array
(LICENSE:MIT)
CONTENTS
Synopsis
Description
Options
Returns
Example
Author
License
SYNOPSIS
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
DESCRIPTION
Given an Ordinal day of the year return a date in the form of a
"DAT" array.
OPTIONS
|
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.
|
|
RETURNS
|
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.
EXAMPLE
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_o2d
Results:
> 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
AUTHOR
John S. Urban, 2015
LICENSE
MIT
| Nemo Release 3.1 | o2d (3) | June 29, 2025 |
Generated by manServer 1.08 from 29b2327c-1cb4-4e7e-a511-14be5c817b46 using man macros.