DOOMSDAY
Day of Week for Given Date
DOOMSDAY
is a C library which
is given the year, month and day of a date, and uses
John Conway's doomsday algorithm to determine
the corresponding day of the week.
Licensing:
The computer code and data files described and made available on this
web page are distributed under
the GNU LGPL license.
Languages:
DOOMSDAY is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
CALENDAR_NYT,
a FORTRAN90 library which
shows the correspondence between dates and the New York Times volume and
issue number;
CALENDAR_RD,
a C++ program which
computes the representation of a given date in a
number of calendrical systems,
by Edward Reingold and Nachum Dershowitz
CALPAK,
a C++ library which
makes various calendar calculations;
DATES,
a dataset directory which
contains lists of dates in various calendar systems.
WEEKDAY,
a C library which
determines the day of the week for a given day.
Reference:
-
Lewis Carroll (Charles Dodgson),
To Find the Day of the Week for Any Given Date,
Nature, 31 March 1887.
-
John Conway,
Tomorrow is the Day After Doomsday,
Eureka,
Volume 36, October 1973, pages 28-31.
-
Gary Meisters,
Lewis Carroll's Day-of-the-Week Algorithm,
Math Horizons,
November 2002, pages 24-25.
Source Code:
Examples and Tests:
List of Routines:
-
DOOMSDAY_GREGORIAN: weekday given any date in Gregorian calendar.
-
I4_MAX returns the maximum of two I4's.
-
I4_MIN returns the minimum of two I4's.
-
I4_MODP returns the nonnegative remainder of I4 division.
-
I4_WRAP forces an I4 to lie between given limits by wrapping.
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
-
WEEKDAY_TO_NAME_COMMON returns the name of a Common weekday.
-
WEEKDAY_VALUES returns the day of the week for various dates.
-
YEAR_IS_LEAP_GREGORIAN returns TRUE if the Gregorian year was a leap year.
You can go up one level to
the C source codes.
Last revised on 28 May 2012.