C Library Functions - d2u (3)
NAME
d2u(3f) - [M_time:UNIX_EPOCH] given DAT date-time array returns Unix
Epoch Time (UET starts at 0000 on 1 Jan. 1970, UTC)
(LICENSE:MIT)
CONTENTS
Synopsis
Description
Options
Returns
Example
Author
License
SYNOPSIS
function d2u(dat) result(unixtime)
integer,intent(in),optional :: dat(8)
real(kind=realtime) :: unixtime
DESCRIPTION
Converts a DAT date-time array to a Unix Epoch Time value. Typically
mathematical operations such as sums, sorting and comparison are
performed with simple UET numeric values, and then they are converted
back.
OPTIONS
|
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]
If not present the current time is used
RETURNS
|
unixtime |
| |
The "Unix Epoch" time, or the number of seconds since 00:00:00 on
January 1st, 1970, UTC.
|
|
EXAMPLE
Sample program:
program demo_d2u
use M_time, only : d2u
implicit none
integer :: dat(8)
call date_and_time(values=dat)
write(*,(" Today is:",*(i0:,":")))dat
write(*,*)Unix Epoch time is ,d2u(dat)
end program demo_d2u
results:
Today is:2016:7:19:-240:2:0:48:561
Unix Epoch time is 1468908048.5610321
AUTHOR
John S. Urban, 2015
LICENSE
MIT
| Nemo Release 3.1 | d2u (3) | June 29, 2025 |
Generated by manServer 1.08 from 59a2eb17-dafc-47bf-abd3-37b35db66264 using man macros.