This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

DaysBetween


gives the number of days between the dates and .

gives the number of days between the given dates.
  • The following options can be given:
CalendarAutomaticspecifies which calendar system to use
  • The default calendar is the usual American calendar, but can be changed with the Calendar option.
The number of days between consecutive days is 1:
The number of days between the same date is 0:
If the second date is earlier than the first date, then a negative result is returned:
John F. Kennedy's presidency is referred to as lasting 1000 days:
Hours, minutes, and seconds do not affect :
In the default (Western/American) calendar, 11 days were deleted in September 1752:
In the default (Western/American) calendar, 1752 had 355 days:
Needs["Calendar`"]
The number of days between consecutive days is 1:
In[2]:=
Click for copyable input
Out[2]=
 
Needs["Calendar`"]
The number of days between the same date is 0:
In[2]:=
Click for copyable input
Out[2]=
 
Needs["Calendar`"]
If the second date is earlier than the first date, then a negative result is returned:
In[2]:=
Click for copyable input
Out[2]=
 
Needs["Calendar`"]
John F. Kennedy's presidency is referred to as lasting 1000 days:
In[2]:=
Click for copyable input
Out[2]=
 
Needs["Calendar`"]
Hours, minutes, and seconds do not affect :
In[2]:=
Click for copyable input
Out[2]=
 
Needs["Calendar`"]
In the default (Western/American) calendar, 11 days were deleted in September 1752:
In[2]:=
Click for copyable input
Out[2]=
 
Needs["Calendar`"]
In the default (Western/American) calendar, 1752 had 355 days:
In[2]:=
Click for copyable input
Out[2]=
Catholic countries adopted the modern Gregorian calendar in 1582, while Britain and her colonies observed the Julian calendar until 1752. Mathematica uses the British calendar, so Catholic date computations require the Gregorian option.
This computes the number of days Voltaire lived:
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:
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, Mathematica applies the British (American) version. There is an issue for 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, it is necessary to use the Gregorian option for Calendar.
This computes the number of days George Washington lived:
This computes the number of days Voltaire lived:
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, will still work with the Calendar->Jewish option, but will not follow the same rules; for example, it will return a positive number even if the second date is lexicographically smaller (smaller in the canonical Mathematica ordering):