subroutine yd_to_mjdn(d,y,mjdn) implicit none integer d,y,j,mjdn c c subroutine returns the modified julian day number (MJDN) given a date (year, c day) in the (modern) gregorian calendar. c MJDN of Nov 17 1858 is 1. This is the day whose Modified c Julian Date (MJD) spans the range 0.0 - 1.0, MJD being the time in days since c 00:00 on Nov 17 1858. MJD is Julian Date - 2400000.5. c j = d+37 + 365*(y+4712) + (y+4715)/4 - (y+4799)/100 + (y+4799)/400 mjdn=j-2400000 return end c c Nov 17 1858 has a Julian Day Number of 2 400 001 c a Julian date of 2 400 000.5 to 2 400 001.5 c a MJDN of 1 c a MJ date of 0.0 to 1.0 c c So the JDN is the average of the JD for that day (midnight to midnight) c the MJDN is the MJD at the end (midnight, 24:00) of the day. c c MJD = MJDN-1 + hours/24.0 c JD = JDN + (hours-12.0)/24.0 integer function mjdn(d,m,y) c MJDN = JDN - 2 400 000 c MJD = JD - 2 400 000.5 c MJDN = int(MJD) + 1 c JDN = int(JD + 0.5) c