WEEKDAY
Determine the Day of the Week
WEEKDAY
is a C++ library which
can determine the day of the week corresponding to a given date;
for instance, the battle of Hastings, on 14 October 1066 (Julian Calendar!),
was a Saturday.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
WEEKDAY 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, Nachum Dershowitz
CALPAK,
a C++ library which
makes various calendar calculations;
DATES,
a dataset directory which
contains lists of dates in various calendar systems.
DOOMSDAY,
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.
TEST_VALUES,
a C++ library which
supplies test values of various mathematical functions.
Reference:

Lewis Carroll (Charles Dodgson),
To Find the Day of the Week for Any Given Date,
Nature, 31 March 1887.

Gary Meisters,
Lewis Carroll's DayoftheWeek Algorithm,
Math Horizons,
November 2002, pages 2425.

Edward Reingold, Nachum Dershowitz,
Calendrical Calculations: The Millennium Edition,
Cambridge University Press, 2001,
ISBN: 0521777526,
LC: CE12.R45.

Edward Richards,
Mapping Time, The Calendar and Its History,
Oxford, 1999,
ISBN: 0198504136,
LC: CE11.R5.
Source Code:
Examples and Tests:
List of Routines:

DIGIT_TO_CH returns the base 10 digit character corresponding to a digit.

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.

JED_TO_WEEKDAY computes the day of the week from a JED.

R8_ABS returns the absolute value of an R8.

R8_MOD returns the remainder of R8 division.

R8_NINT returns the nearest integer to an R8.

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.

Y_COMMON_TO_ASTRONOMICAL converts a Common year to an Astronomical year.

YMD_TO_S_COMMON writes a Common YMD date into a string.

YMD_TO_WEEKDAY_COMMON returns the weekday of a Common YMD date.

YMD_TO_WEEKDAY_ENGLISH returns the weekday of an English YMD date.

YMDF_COMPARE compares two YMDF dates.

YMDF_TO_JED_COMMON converts a Common YMDF date to a JED.

YMDF_TO_JED_ENGLISH converts an English YMDF date to a JED.

YMDF_TO_JED_GREGORIAN converts a Gregorian YMDF date to a JED.

YMDF_TO_JED_JULIAN converts a Julian YMDF date to a JED.
You can go up one level to
the C++ source codes.
Last revised on 25 March 2010.