calendar_rd, a C++ code which returns information about a given date, by Edward Reingold, Nachum Dershowitz.

The program is interactive. The user enters y, m and d, which represent the year, (numeric) month, and day of a given date. Note that y must be positive. Also note that all dates are implicitly using the Gregorian calendar, extended backwards indefinitely.

Given date = (y,m,d), the program returns

The program halts when a nonpositive value of y is entered.


This code is in the public domain, but any use of it should publicly acknowledge its source.


calendar_rd is available in a C++ version.

Related Data and Programs:


analemma, a C++ code which evaluates the equation of time, a formula for the difference between the uniform 24 hour day and the actual position of the sun, by Brian Tung.

calpak, a C++ code which converts between dates as computed on various calendars.

dates, a dataset directory which contains lists of dates in various calendar systems.

doomsday, a C++ code 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.

weekday, a C++ code which determines the day of the week for a given day.


Edward Reingold, Nachum Dershowitz.


  1. Edward Reingold, Nachum Dershowitz,
    Calendrical Calculations: The Millennium Edition,
    Cambridge University Press, 2001,
    ISBN: 0-521-77752-6,
    LC: CE12.R45.
  2. Edward Reingold, Nachum Dershowitz,
    Calendrical Calculations I,
    Software - Practice and Experience,
    Volume 20, Number 9, September 1990, pages 899-928.
  3. Edward Reingold, Nachum Dershowitz, Stewart Clamen,
    Calendrical Calculations, II: Three Historical Calendars,
    Software - Practice and Experience,
    Volume 23, Number 4, pages 383-404, April 1993.

Source Code:

Last revised on 12 February 2020.