此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)

DaysBetween

DaysBetween[{year1, month1, day1}, {year2, month2, day2}]
gives the number of days between the dates {year1, month1, day1} and {year2, month2, day2}.
DaysBetween[{year1, month1, day1, hour1, minute1, second1}, {year2, month2, day2, hour2, minute2, second2}]
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.
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 DaysBetween:
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]=