Returns the year, month, day, hr, min, sec for the specified Julian date.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | julian_date |
julian date |
||
integer, | intent(out) | :: | year | |||
integer, | intent(out) | :: | month | |||
integer, | intent(out) | :: | day | |||
integer, | intent(out) | :: | hrs | |||
integer, | intent(out) | :: | min | |||
real(kind=wp), | intent(out) | :: | sec |
pure subroutine calendar_date_realsec(julian_date,year,month,day,hrs,min,sec) implicit none real(wp),intent(in) :: julian_date !! julian date integer,intent(out) :: year integer,intent(out) :: month integer,intent(out) :: day integer,intent(out) :: hrs integer,intent(out) :: min real(wp),intent(out) :: sec integer :: i,j,k,l,n,jd real(wp) :: frac_day jd = int(julian_date) l = jd+68569 n = 4*l/146097 l = l-(146097*n+3)/4 i = 4000*(l+1)/1461001 l = l-1461*i/4+31 j = 80*l/2447 k = l-2447*j/80 l = j/11 j = j+2-12*l i = 100*(n-49)+i+l year = i month = j day = k frac_day = julian_date - real(jd,wp) + 0.5_wp hrs = int(frac_day*24.0_wp) min = int((frac_day - hrs/24.0_wp) * 1440.0_wp) sec = (frac_day - hrs/24.0_wp - min/1440.0_wp) * 86400.0_wp if (sec == 60.0_wp) then sec = 0.0_wp min = min + 1 end if if (min == 60) then min = 0 hrs = hrs + 1 end if end subroutine calendar_date_realsec