calpak
calpak,
a Python code which
computes various simple calendrical quantities. It can work with
various calendars including Egyptian, English, French Revolutionary,
Gregorian, Julian, and Julian Ephemeris Date. It can convert a
date from one calendar to another. It can return the day of the week
for a given date. It can convert from day-number/year to day/month/year
format. It can calculate the time difference between two dates.
Some common methods of marking the date include:
-
JED, the Julian Ephemeris Date, a count of days since
a long time ago;
-
YMD, for "year, month, day";
-
YJ, for "year, day number".
While there have been many calendars over the years, it
is instructive to contemplate just the crazy story of our
current "common" calendar. To this day, people disagree about
whether there was a year 0, although the Julian calendar
was a Roman invention, and Dionysius Exiguus, who gets the
blame for shifting the Julian calendar's starting date to
the birth year of Christ four hundred years afterwards, didn't
have an accurate idea of when that was.
There was a
controversial shift from the Julian to the Gregorian calendar,
which took place piecemeal throughout the Catholic
world, with several countries actually switching back and
forth more than once, and with England holding out on the
old system until after George Washington was born (which
means he was born on February 11 AND February 22).
People didn't agree on when the year started, so that January and
February, in particular, were a little murky about which
year they belonged to, and the year sometimes started
around March 22, near the vernal equinox.
There are a number of side issues, including
-
determining the day of the week of a given date;
-
determining the number of days between two dates;
-
the computation of the date of certain holidays;
Licensing:
The information on this web page is distributed under the MIT license.
Languages:
calpak is available in
a C version and
a C++ version and
a Fortran90 version and
a MATLAB version and
an Octave version and
a Python version.
Related Data and Programs:
dates,
a dataset directory which
contains lists of dates in various calendar systems.
doomsday,
a Python 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 Python code which
determines the day of the week for a given day.
weekday_zeller,
a Python code which
uses Zeller's congruence to determine the day of the week corresponding
to a given date, such as 13 July 1989, Gregorian calendar,
... which was a Thursday.
Reference:
-
Anonymous,
A Correction; Welcome to 51,254,
The New York Times,
01 January 2000, Volume 149, Issue 51254.
-
James Barron,
What's in a Number? 143 Years of News,
The New York Times,
14 March 1995, Volume 144, Issue 50000.
-
Bonnie Blackburn, Leofranc Holford-Stevens,
The Oxford Companion to the Year,
Oxford, 1999,
ISBN: 0192142313,
LC: CE73.B553.
-
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.
-
Peter Duffett-Smith,
Practical Astronomy With Your Calculator,
Third Edition,
Cambridge University Press, 1996,
ISBN: 0-521-35699-7,
LC: QB62.5.D83.
-
Donald Knuth,
The Art of Computer Programming,
Volume 1, Fundamental Algorithms,
Third Edition,
Addison-Wesley, 1997,
ISBN: 0201896834,
LC: QA76.6.K64.
-
Donald Knuth,
The Calculation of Easter,
Communications of the ACM,
Volume 5, Number 4, April 1962, pages 209-210.
-
Gary Meisters,
Lewis Carroll's Day-of-the-Week Algorithm,
Math Horizons,
November 2002, pages 24-25.
-
Lance Latham,
Standard C Date/Time code,
Programming the World's Calendars and Clocks,
Miller Freeman, 1998,
ISBN: 0-87930-496-0.
-
The New York Times,
Page One, 1896-1996, A Special Commemorative Edition Celebrating the
100th Anniversary of the Purchase of the New York Times by Adolph S Ochs,
Galahad Books, 1996,
ISBN: 0-88365-961-1,
LC: D411.P25.
-
The New York Times,
The Complete First Pages, 1851-2008,
Black Dog & Leventhal Publishers, 2008,
ISBN13: 978-1-57912-749-7,
LC: D351.N53.
-
Thomas OBeirne,
Puzzles and Paradoxes,
Oxford University Press, 1965,
LC: QA95.O2.
-
Frank Parise, editor,
The Book of Calendars,
Gorgias, 2002,
ISBN: 1931956766,
LC: CE11.K4.
-
Edward Reingold, Nachum Dershowitz,
Calendrical Calculations: The Millennium Edition,
Cambridge University Press, 2001,
ISBN: 0-521-77752-6,
LC: CE12.R45.
-
Edward Reingold, Nachum Dershowitz,
Calendrical Calculations I,
Software - Practice and Experience,
Volume 20, Number 9, September 1990, pages 899-928.
-
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.
-
Edward Richards,
Mapping Time, The Calendar and Its History,
Oxford, 1999,
ISBN: 0-19-850413-6,
LC: CE11.R5.
-
Ian Stewart,
Easter is a Quasicrystal,
Scientific American,
Volume 284, Number 3, March 2001, pages 80-83.
-
Daniel Zwillinger, editor,
CRC Standard Mathematical Tables and Formulae,
30th Edition,
CRC Press, 1996,
ISBN: 0-8493-2479-3,
LC: QA47.M315.
Source Code:
Last revised on 21 January 2020.