!$Author$ !$Date$ !$Revision$ !$HeadURL$ function julday( dd, mm, yyyy ) result( julian_day ) ! + + + PURPOSE + + + ! In this routine JULDAY returns the Julian Day Number which begins at ! noon of the gregorian calendar date specified by day "dd", month "mm", & year "yyyy" ! All are integer variables. Positive year signifies A.D.; zero and negative, B.C. ! Calendar dates before 1582 will not match dates on the Julian calendar used ! at the time. ! Based on info from http://en.wikipedia.org/wiki/Julian_day, which references ! http://www.astro.uu.nl/~strous/AA/en/reken/juliaansedag.html, the code ! was revised to use the Astronomical Gregorian calendar, which takes the ! present pattern of leap years back into the past. This is ideal for ! our purposes with no year getting short changed. Integer math method ! is taken from Wikipedia article. ! + + + ARGUMENT DECLARATIONS + + + integer, intent(in) :: dd ! integer value of day in the range 1-31 integer, intent(in) :: mm ! month in the range 1-12 integer, intent(in) :: yyyy ! year (negative B.C., positive A.D.) integer :: julian_day julian_day = (1461 * (yyyy + 4800 + (mm - 14)/12))/4 & & + (367 * (mm - 2 - 12 * ((mm - 14)/12)))/12 & & - (3 * ((yyyy + 4900 + (mm - 14)/12)/100))/4 + dd - 32075 end function julday