[UP]


Manual Reference Pages  - u2d (3)

NAME

u2d(3f) - [M_time:UNIX_EPOCH] given Unix Epoch Time returns DAT date-time array (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Example
Author
License

SYNOPSIS

function u2d(unixtime) result (dat)

    class(*),intent(in),optional      :: unixtime
    ! integer
    ! real
    ! real(kind=realtime)

integer :: dat(8)

DESCRIPTION

Given Unix Epoch Time returns DAT date-time array

OPTIONS

unixtime
  The "Unix Epoch" time, or the number of seconds since 00:00:00 on January 1st, 1970, UTC. If not present, use current time.

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]

EXAMPLE

Sample program:

    program demo_u2d
    use M_time, only : u2d, d2u, fmtdate, realtime
    implicit none
    real(kind=realtime) :: today
    integer :: dat(8)
       ! get the date using intrinsic
       call date_and_time(values=dat)
       ! convert today to Julian Date
       today=d2u(dat)
       write(*,*)’Today=’,fmtdate(u2d(today))
       ! subtract day
       write(*,*)’Yesterday=’,fmtdate(u2d(today-86400.0d0))
       ! add day
       write(*,*)’Tomorrow=’,fmtdate(u2d(today+86400.0d0))
    end program demo_u2d

results:

    Today=Tuesday, July 19th, 2016 11:10:08 AM
    Yesterday=Monday, July 18th, 2016 11:10:08 AM
    Tomorrow=Wednesday, July 20th, 2016 11:10:08 AM

AUTHOR

John S. Urban, 2015

LICENSE

Public Domain


u2d (3) March 11, 2021
Generated by manServer 1.08 from cef7f2f3-faa2-4a95-8d11-82e93ef92d22 using man macros.