[UP]


Manual Reference Pages  - u2d (3)

NAME

u2d(3f) - [M_time] 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)
       call date_and_time(values=dat) ! get the date using intrinsic
       today=d2u(dat)                 ! convert today to Julian Date
       write(*,*)’Today=’,fmtdate(u2d(today))
       write(*,*)’Yesterday=’,fmtdate(u2d(today-86400.0d0)) ! subtract day
       write(*,*)’Tomorrow=’,fmtdate(u2d(today+86400.0d0))  ! add day
    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) July 05, 2020
Generated by manServer 1.08 from 2e87532d-9c8e-4e73-8d4f-cb9fc07ffe75 using man macros.