caldat Subroutine

public pure subroutine caldat(tjd, i, m, k, h)

This subroutine computes calendar date and time, given julian date. input julian date can be based on any ut-like time scale (utc, ut1, tt, etc.) - output time value will have same basis. output calendar date will be gregorian. algorithm by fliegel and van flandern.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tjd

julian date

integer, intent(out) :: i

year

integer, intent(out) :: m

month number

integer, intent(out) :: k

day of month

real(kind=wp), intent(out) :: h

ut hours


Source Code

    pure subroutine caldat (tjd,i,m,k,h)

    implicit none

    real(wp),intent(in) :: tjd !! julian date
    integer,intent(out) :: i !! year
    integer,intent(out) :: m !! month number
    integer,intent(out) :: k !! day of month
    real(wp),intent(out) :: h !! ut hours

    integer :: jd !! julian day no for day beginning at greenwich noon on given date
    integer :: l,n
    real(wp) :: djd

    djd = tjd + 0.5d0
    jd = djd
    h = mod (djd,1.0_wp) * 24.0_wp
    l = jd + 68569
    n = 4*l/146097
    l = l - (146097*n+3)/4
    i = 4000*(l+1)/1461001
    l = l - 1461*i/4 + 31
    m = 80*l/2447
    k = l - 2447*m/80
    l = m / 11
    m = m + 2 - 12*l
    i = 100*(n-49) + i + l

    end subroutine caldat