caldate_mjd(3)                                     caldate_mjd(3)



NAME
       caldate_mjd - manipulate calendar dates

SYNTAX
       #include <caldate.h>

       void caldate_frommjd(&cd,day,weekday,yearday);
       long caldate_mjd(&cd);
       void caldate_normalize(&cd);

       void caldate_easter(&cd);

       struct caldate cd;
       long day;
       int *weekday;
       int *yearday;

BASIC CONVERSIONS
       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 day.

       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  if  weekday  is
       nonzero.   It  stores  the  day of the year in **yearday if
       yearday is nonzero.

       caldate_mjd returns the modified Julian day number  corre-
       sponding to the date in cd.

       caldate_mjd accepts days outside the range 1 to 31, refer-
       ring 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_normalize calls 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 cal-
       endar date back into cd.

OTHER FUNCTIONS
       caldate_easter reads the year from cd and then changes  cd
       to the date of Easter in the same year.

LIMITATIONS
       The  caldate routines currently support the Gregorian cal-
       endar, which was defined in 1582 and adopted at  different
       times  in different countries.  For earlier dates the cal-
       date routines work  with  ``virtual  Gregorian,''  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.  The caldate_frommjd and cal-
       date_mjd routines will be upgraded accordingly.  The  cur-
       rent caldate_frommjd and caldate_mjd routines are not use-
       ful 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 lloonnggs
       before then.  caldate_mjd does not check for overflow.

SEE ALSO
       caldate(3)



                                                   caldate_mjd(3)
