DayCount

DayCount[date1, date2]
gives the number of days in the range from to .

DayCount[date1, date2, daytype]
gives the number of days of the specified daytype in the range from to .

Details and OptionsDetails and Options

  • Dates can be specified in the following forms:
  • {y,m,d}year, month, day
    {y,m}the first day of the specified month
    {y}the first day of the first month of the year y
    "string"date as a string ()
  • Possible day types are: All (default); ; ; Monday through Sunday; ; ; and .
  • DayCount excludes the beginning date of the date range.
  • DayCount takes the following options:
  • CalendarType"Gregorian"calendar in which the dates have been specified
    HolidayCalendar{"UnitedStates","Default"}holiday schedule and subspecification for the business day and holiday computations
  • In the Jewish calendar, the weekdays are Sunday through Thursday.

ExamplesExamplesopen allclose all

Basic Examples (4)Basic Examples (4)

Print the number of days in a date range:

In[1]:=
Click for copyable input
Out[1]=

Print the number of days that fall on a given day of the week:

In[1]:=
Click for copyable input
Out[1]=

Print the number of business days in a date range:

In[1]:=
Click for copyable input
Out[1]=

Print all holidays in the current year, subject to the default holiday schedule:

In[1]:=
Click for copyable input
Out[1]=
New in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »