struct caldate cd;
Every calendar date has a
modified Julian day number. The day number increases by 1 every day.
Day number 0 is 17 November 1858.
Day number 51604 is 1 March 2000.
caldate_frommjd puts into
cd the date corresponding to the modified Julian day number
caldate_frommjd also computes the day of the week (0 through 6)
and the day of the year (0 through 365).
It stores the day of the week in
weekday is nonzero.
It stores the day of the year in
yearday is nonzero.
caldate_mjd returns the modified Julian day number corresponding to the date in
caldate_mjd accepts days outside the range 1 to 31,
referring to days before the beginning or after the end of the month.
It also accepts months outside the range 1 to 12,
referring to months before the beginning or after the end of the year.
caldate_frommjd with the result of
caldate_mjd. This means that it accepts out-of-range months and out-of-range days in
cd, and puts a valid calendar date back into
caldate routines currently support the Gregorian calendar,
which was defined in 1582 and adopted at different times
in different countries.
For earlier dates the
caldate routines work with
defined mathematically by the 400-year Gregorian cycle
for years before 1582.
The Julian calendar is not supported.
The Gregorian calendar will be replaced by a new calendar
within a few thousand years.
caldate_mjd routines will be upgraded accordingly.
caldate_mjd routines are not useful for dates far in the future.
Day numbers will overflow a 32-bit
long sometime after the year 5000000;
all systems should upgrade to 64-bit
longs before then.
caldate_mjd does not check for overflow.