Dec 072017
Julian, Gregorian, and Modified Julian C functions with source.
File JULIDATE.ZIP from The Programmer’s Corner in
Category C Source Code
Julian, Gregorian, and Modified Julian C functions with source.
File Name File Size Zip Size Zip Type
DOYJ.C 3318 1413 deflated
DOYJ.EXE 13089 8090 deflated
DOYMJD.C 3426 1463 deflated
DOYMJD.EXE 13183 8163 deflated
JDOY.C 3164 1370 deflated
JDOY.EXE 13095 8108 deflated
JULIAN.DOC 5639 2535 deflated
MJDDOY.C 3169 1359 deflated
MJDDOY.EXE 13057 8098 deflated

Download File JULIDATE.ZIP Here

Contents of the JULIAN.DOC file


The Modified Julian Day (MJD) is an abbreviated version of the
old Julian Day (JD) dating method which has been in use for centuries by
astronomers, geophysicists, chronologers and others who needed to have an
unambiguous dating system based on continuing day counts.

The JD counts have very little to do with the Julian calendar which was
introduced by Julius Caesar (44 BC) and in force until 1682 when Pope Gregory
directed the use of an improved calendar, now known as the Gregorian Calendar.
In the case of the Julian day count, the name was given because at the time,
the Julian calendar was in use and, therefore, the epoch of the day count
was fixed in respect to it. The JD counts days within one Julian Period
of exactly 7980 Julian years of 365.25 days.

Start of the JD count is 12 NOON 1 JAN -4713 (4712 BC, Julian Proleptic
Calendar). Note that this day count conforms with the astronomical convention
starting the day at noon, in contrast with the civil practice where the
day starts with midnight (in popular use the belief is widespread that the
day ends with midnight but this is not the proper scientific use).

The Julian Period is given by the time it takes from one coincidence to the
next of a solar cycle (28), a lunar cycle (19), and the Roman Indiction
(a tax cycle of 15 years). At any rate, this period is of interest only
in regard to the adoption of the start, at which time all periods counted
backwards were in coincidence.

The Modified Julian Day, on the other hand, was introduced by
space scientists in the late 50's of this century.
It is defined as:

MJD = JD - 2400000.5

The half day is subtracted so that the day starts at midnight in
conformance with civil time reckoning. This MJD has been sanctioned by
various international commissions such as IAU, CCIR, and others who
recommend it as a decimal day count which is independent of the civil
calendar in use. To give dates in this system is convenient in all cases
where data are collected over long periods of time. Examples are double
star and variable star observations, the computation of time differences
over long periods of time such as in the computation of small rate
differences of atomic clocks, etc.

The MJD is a convenient dating system with only 5 digits, sufficient for
most modern purposes. The days of the week can easily be computed because
the same weekday is obtained for the same remainder of the MJD after
division by 7.


MJD 46324 = MON., 16 SEPT, 1985

Division of the MJD by 7 gives a remainder of 5. All Mondays have this same
remainder of 5.

Note that for 1986 the MJD = 46430 + DOY
For 1987 the MJD = 46795 + DOY
For 1988 the MJD = 47160 + DOY

where DOY is the Day of the respective Year.

The MJD (and even more so the JD) has to be well distinguished from this
day of the year (DOY). This is also often but erroneously called Julian
Date, when in fact it is a Gregorian Date expressed as number of days in
the year. But this erroneous and misleading practice originated by those
who were simply ignorant of long established consistent standards.
This confusion presents a real problem which cannot be taken lightly.
A continuation of the use of expressions "Julian" or "J" day in the sense of
a Gregorian Date is certainly not helpful. It can only lead to
possibly dangerous mistakes, increased confusion, and will eventually destroy
whatever standard practices exist.

The MJD has been officially recognized by the International Astronomical
Union (IAU), and by the Consultative Committe for Radio (CCIR), the
advisory committee to the International Telecommunications Union (ITU).

The pertinent document is:


This document is contained in the CCIR "Green Book" Volume VII.
Additional, extensive documentation regarding the JD is contained in
the Explanatory Supplement to the Astronomical Ephemeris and Nautical
Almanac, and in the yearbooks themselves, now called The Astronomical Almanac.
The Almanac for Computers also provides information on such matters.

NASA sometimes uses what they call the Truncated MJD or TJD. It is
simply the MJD less the first digit. The above used date would be
6324. Note, however, that in this case the remainder for the days of
the week comes out differently (3 for Mondays).


Gordon Moyer, "The Origin of the Julian Day System", Sky and Telescope,
vol. 61, pp. 311-313 (April 1981). See also a subsequent letter
by R.H. van Gent, Sky and Telescope, vol.62, p.16 (July 1981).

The programs have been compiled with the following C- compilers:
MS-C, Turbo-C (Borland), and Lattice -C.

They should compile on any other compiler as well, as there are no
systems resources required. Uh..... now that we have the date, does
anyone have the correct time?

The programs:
JDOY computes JD to Gregorian Date (day of the year)
MJDDOY computes MJD to Gregorian Date
DOYJ computes Gregorian Date to JD
DOYMJD computes Gregorian Date to MJD

 December 7, 2017  Add comments

Leave a Reply