Calendar`
Calendar`

DaysPlus

As of Version 10.0, calendar functionality is built into the Wolfram Language »

DaysPlus[{year,month,day},n]

gives the date n days after the date {year,month,day}.

DaysPlus[{year,month,day,hour,minute,second},n]

gives the date n days after the date {year,month,day,hour,minute,second}.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Computing the next day:

To compute an earlier date, a negative second argument is used:

Hours, minutes, and seconds are retained by DaysPlus:

Options  (6)

Calendar  (6)

Catholic countries adopted the modern Gregorian calendar in 1582, while Britain and her colonies observed the Julian calendar until 1752. The Wolfram Language uses the British calendar, so Catholic date computations require the Gregorian option.

When changing calendars in 1752, Britain deleted 11 days in September:

In Catholic countries using the Gregorian calendar, no days were deleted:

The Russian Orthodox church has retained the Julian Calendar. Their year 1900 was a leap year:

The standard Western year 1900 was not a leap year:

The Islamic year is much shorter than the Western year:

The length of the Jewish year varies greatly because there is a leap month:

Applications  (3)

By definition, the Christian holiday of Ash Wednesday is 46 days before Easter:

You can easily compute the date after a given number of weeks:

Yom Kippur is the tenth day of the Jewish year, so this program returns the Western (Gregorian) date of Yom Kippur for a given Western year:

Possible Issues  (2)

The Western calendar was modified from Julian to Gregorian for better accuracy. The change deleted 10 days in October 1582 in Catholic countries and deleted 11 days in September 1752 in Britain and her colonies. By default, the Wolfram Language applies the British (American) version. There is an issue for DaysPlus concerning dates after October 14, 1582 and before September 14, 1752. For British dates, the default gives the correct answer. For dates in Catholic countries, use the Gregorian option for Calendar.

In the default (Western American) calendar, dates in September 1752 were deleted:

Because it is a solar and lunar calendar (the year follows the seasons and the months keep track of the phases of the moon), the Jewish calendar has an extra leap month 7 times every 19 years. This leap month occurs in spring the month preceding Passover, so it is appropriate to count the Jewish months starting with Nisan, the month of Passover, as follows:

Since the Jewish year begins in the fall, this numeration of months will not always follow an increasing order; that is, later dates in the same year may have a smaller number for the month:

For this reason, DaysPlus will still work with the Calendar->Jewish option, but will not follow the same rules; for example, it will return a lexicographically smaller (smaller in the canonical Wolfram Language ordering) number for a later date: