This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Add-ons / Standard Packages / Miscellaneous  /

Miscellaneous`Calendar`

This package provides a unified treatment of the basic calendar operations. The main idea is to treat the calendar as a generalized number system, so that days, weeks, months, and years are thought of as generalizing the digits of a number in a given base. A detailed analysis of how this is done is given in the third chapter of Computational Recreations in Mathematica, by Ilan Vardi (Addison-Wesley, 1991). The key to the implementation is Mathematica's ability to work consistently with general objects.


Calendar computations using the standard calendar.

  • This loads the package.
  • In[1]:= <<Miscellaneous`Calendar`

  • The basic calendar utility is finding the day of the week.
  • In[2]:= DayOfWeek[{1988, 6, 23}]

    Out[2]=

  • This computes the number of days between the given dates.
  • In[3]:= DaysBetween[{1900, 1, 1}, {1901, 1, 1}]

    Out[3]=

  • January 2, 1901 is

    days after January 1, 1900.
  • In[4]:= DaysPlus[{1900, 1, 1}, 366]

    Out[4]=


    Calendar computations using specified systems.

    The Gregorian calendar has been in use in the Western world since 1582 by Roman Catholic countries, and since 1752 by English-speaking countries. The Gregorian calendar counts leap years every year divisible by 4, except for centuries not divisible by , which are not leap years. For example, 1900 was not a leap year.
    The calendar used before the Gregorian calendar was the Julian calendar. This system counts every year divisible by 4 as a leap year. At present there is a disparity of 13 days between the calendars. The changeover between these two calendars was done by omitting a number of days, therefore one must account for this in computations.
    The default calendar used in this package is the one used by England and her former colonies (e.g., the United States). It uses the Gregorian calendar for dates starting with September 14, 1752, and the Julian calendar for dates up to September 2, 1752. If you do not specify a system, this is the calendar used by DayOfWeek, DaysBetween, and DaysPlus.
    The Julian calendar is valid to March 1, year 4, but not before then since the year 4 was not

    a leap year.
    The Islamic calendar is used mainly to keep track of Islamic holy days. It is a purely lunar calendar and a year has either 354 or 355 days. The months do not correspond to the solar year and migrate over the solar year following a 30-year cycle. The Islamic calendar began on the Hejira, which was July 16, 622, in the Julian calendar.

  • In the Julian calendar, the year beginning a century not divisible by 400 is a leap year.
  • In[5]:= DaysBetween[{1900, 1, 1}, {1901, 1, 1},
    Calendar -> Julian]

    Out[5]=

  • The Gregorian calendar is 13 days ahead of the Julian calendar.
  • In[6]:= CalendarChange[{1992, 2, 29},
    Gregorian, Julian]

    Out[6]=

  • Here is a conversion into the Islamic system.
  • In[7]:= CalendarChange[{1992, 2, 29},
    Gregorian, Islamic]

    Out[7]=

  • This gives the first day in the Islamic system, the date of the Hejira. The date is given in the Julian calendar because the Gregorian calendar was not used before 1582.
  • In[8]:= CalendarChange[{1,1,1}, Islamic, Julian]

    Out[8]=


    Dates of holidays.

  • In 1945, Easter Sunday was on April 1.
  • In[9]:= EasterSunday[1945]

    Out[9]=

  • This uses the pre-Gregorian computation, but the result is given as a Gregorian date.
  • In[10]:= EasterSundayGreekOrthodox[1984]

    Out[10]=

  • This gives the date of the Jewish New Year in the Gregorian year 1997.
  • In[11]:= JewishNewYear[1997]

    Out[11]=