C Library Functions - j2d (3)
NAME
j2d(3f) - [M_time:JULIAN] given a JD (Julian Date) returns a
date-time array DAT.
(LICENSE:MIT)
CONTENTS
Synopsis
Description
Options
Returns
Example
Author
License
SYNOPSIS
function j2d(julian) result(dat)
real(kind=realtime),intent(in),optional :: julian
integer :: dat(8)
DESCRIPTION
Converts a Julian Date to a DAT date-time array.
OPTIONS
|
julian |
A Julian Date (JD) is the number of days since
noon (not midnight) on January 1st, 4713 BC.
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_j2d
use M_time, only : j2d, d2j, fmtdate, realtime
implicit none
integer,parameter :: dp=kind(0.0d0)
real(kind=realtime) :: today
integer :: dat(8)
call date_and_time(values=dat) ! get the date using intrinsic
today=d2j(dat) ! convert today to Julian Date
write(*,*)Today=,fmtdate(j2d(today))
! math is easy with Julian Days and Julian Dates
write(*,*)Yesterday=,fmtdate(j2d(today-1.0_dp))
write(*,*)Tomorrow=,fmtdate(j2d(today+1.0_dp))
end program demo_j2d
results:
Today=Tuesday, July 19th, 2016 08:48:20 AM
Yesterday=Monday, July 18th, 2016 08:48:20 AM
Tomorrow=Wednesday, July 20th, 2016 08:48:20 AM
AUTHOR
John S. Urban, 2015
LICENSE
MIT
| Nemo Release 3.1 | j2d (3) | June 29, 2025 |
Generated by manServer 1.08 from 6d2ca697-3fbc-4ff2-97e2-d84c3dccf610 using man macros.