Determine the Day of the Week

WEEKDAY, a C++ code which determines 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.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


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_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.



  1. Lewis Carroll (Charles Dodgson),
    To Find the Day of the Week for Any Given Date,
    Nature, 31 March 1887.
  2. Gary Meisters,
    Lewis Carroll's Day-of-the-Week Algorithm,
    Math Horizons,
    November 2002, pages 24-25.
  3. Edward Reingold, Nachum Dershowitz,
    Calendrical Calculations: The Millennium Edition,
    Cambridge University Press, 2001,
    ISBN: 0-521-77752-6,
    LC: CE12.R45.
  4. Edward Richards,
    Mapping Time, The Calendar and Its History,
    Oxford, 1999,
    ISBN: 0-19-850413-6,
    LC: CE11.R5.

Source Code:

Last revised on 09 April 2020.