ODU SO GLOBEC: TIME ROUTINES
Julian and Modified Julian Day Routines
The Julian Day system counts sequential days since come time in the past. By
decree, Julian Day (JD) zero is noon on 1 January in the year -4712 which is
4713 BC. This running day counter should not be confused with Day of Year
(DOY) which is commonly, but incorrectly, termed Julian Day.
Modified Julian Day (MJD) was defined in the mid 1950's in the interests of
astronomy and space science as MJD = JD - 2400000.5, which accomplishes two
things. The half day shift makes the day start at midnight, which is the
current time standard. Subtracting the large number shifts the zero day to a
more recent time (May 23, 1968) allowing smaller numbers to represent time.
Matlab and FORTRAN routines are provided for conversion between Gregorian
dates and Modified Julian dates.
For more information on these issues, please see Numberical Recipes, or the
Navy Official Time site history page (tycho.usno.navy.mil/history.html).
- Fortran
- Main Routines:
- jul2greg
converts a modified julian day to hour, day, month and year.
- greg2jul
converts day (with fractional days), month and year to
a modified julian day.
- Support Routines:
- caldate
a subroutine that converts a modified julian day to time, day,
month and year. A date and time character string is provided
in addition to integer values of day, month and year. (calls
gregorian)
- gregorian
a subroutine that converts a julian day to the gregorian
day, month and year. Fractional days are not accounted for.
- modjulday
a subroutine that converts gregorian day, month and year to
modified julian day. (calls julday)
- julday
a function routine that converts gregorian day, month and year
to julian day.
- Matlab:
- Main Routines:
-
testtime
this routine calls the conversion routines for several test
values to show that the conversions work. It also provides an
example of how to use the routines.
- Support Routines: all of these are matlab functions.
- mjul2greg
converts a modified julian day to day, month and year. It also
calculates the yearday (running day in the year).
[year, month, day, yearday] = mjul2greg(julday)
- jul2greg
converts a julian day to hour, day, month and year. It also
calculates the yearday (running day in the year).
[year, month, day, yearday] = jul2greg(julday)
- greg2jul
converts day (with fractional days), month and year to
a julian day. jday = greg2jul(yr, mo, day)
- greg2mjul
converts day (with fractional days), month and year to
a modified julian day. jday = greg2mjul(yr, mo, day)
Go to the top of this page.
Written by J. Klinck.
July, 2000.
Send questions or comments by e-mail to
klinck@ccpo.odu.edu