julian_to_date(3f) - [M_time:JULIAN] converts a JD(Julian Date) to a DAT date-time array. (LICENSE:MIT)
Synopsis
Description
Options
Returns
Example
Author
License
subroutine julian_to_date(julian,dat,ierr)
real(kind=realtime),intent(in) :: julian integer,intent(out) :: dat(8) integer,intent(out) :: ierr
Converts a Julian Date(JD) value to a DAT date-time array.Julian dates are simply a continuous count of days and fractions since noon Universal Time on January 1, 4713 BC (on the Julian calendar). Julian dates are widely used as time variables within astronomical software. Typically, a 64-bit floating point (double precision) variable can represent an epoch expressed as a Julian date to about 20 microsecond precision.
julian Julian Date (days)
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]
ierr | Error code. If 0 no error occurred. |
Sample program:
program demo_julian_to_date use M_time, only : julian_to_date, fmtdate, realtime implicit none integer,parameter :: dp=kind(0.0d0) real(kind=realtime) :: juliandate integer :: dat(8) integer :: ierr ! set sample Julian Date juliandate=2457589.129_dp ! create DAT array for this date call julian_to_date(juliandate,dat,ierr) write(*,*)Sample Date=,fmtdate(dat) ! go back one day call julian_to_date(juliandate-1.0_dp,dat,ierr) write(*,*)Day Before =,fmtdate(dat) ! go forward one day call julian_to_date(juliandate+1.0_dp,dat,ierr) write(*,*)Day After =,fmtdate(dat) end program demo_julian_to_dateResults:
Sample Date=Tuesday, July 19th, 2016 11:05:45 AM UTC-04:00 Day Before =Monday, July 18th, 2016 11:05:45 AM UTC-04:00 Day After =Wednesday, July 20th, 2016 11:05:45 AM UTC-04:00
John S. Urban, 2015
Nemo Release 3.1 | julian_to_date (3) | February 23, 2025 |