WOLFRAM

DayCount[date1,date2]

gives the number of days from date1 to date2.

DayCount[date1,date2,daytype]

gives the number of days of the specified daytype from date1 to date2.

Details and Options

  • Dates can be specified in the following forms:
  • DateObject[]date object
    {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 ("Jan. 1, 2000")
  • Possible day types are: All (default), "Weekday", "Weekend", Monday through Sunday, "EndOfMonth", "BusinessDay", "BeginningOfMonth", and "Holiday".
  • 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.

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Print the number of days in a date range:

Out[1]=1

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

Out[1]=1

Print the number of business days in a date range:

Out[1]=1

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

Out[1]=1

Scope  (2)Survey of the scope of standard use cases

Compute the average number of weekend days this century:

Out[1]=1

Compute the average number of non-weekend Swedish holidays this century:

Out[1]=1

Options  (3)Common values & functionality for each option

CalendarType  (1)

Count all US holidays that will occur in the current Islamic calendar year:

Out[1]=1

HolidayCalendar  (2)

Count holidays in India:

Out[1]=1

Different markets within a country may have different holiday schedules:

Out[1]=1
Out[2]=2
Out[3]=3

Applications  (1)Sample problems that can be solved with this function

Compute the number of days until the next US presidential election (first Tuesday after the first Monday in November of leap years):

Out[1]=1

Properties & Relations  (2)Properties of the function, and connections to other functions

DayCount is equivalent to the length of the list output by DayRange for the same set of inputs:

Out[1]=1

Holidays, weekends, and business days always add up to the total number of days in the range:

Out[1]=1
Wolfram Research (2012), DayCount, Wolfram Language function, https://reference.wolfram.com/language/ref/DayCount.html (updated 2014).
Wolfram Research (2012), DayCount, Wolfram Language function, https://reference.wolfram.com/language/ref/DayCount.html (updated 2014).

Text

Wolfram Research (2012), DayCount, Wolfram Language function, https://reference.wolfram.com/language/ref/DayCount.html (updated 2014).

Wolfram Research (2012), DayCount, Wolfram Language function, https://reference.wolfram.com/language/ref/DayCount.html (updated 2014).

CMS

Wolfram Language. 2012. "DayCount." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/DayCount.html.

Wolfram Language. 2012. "DayCount." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/DayCount.html.

APA

Wolfram Language. (2012). DayCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DayCount.html

Wolfram Language. (2012). DayCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DayCount.html

BibTeX

@misc{reference.wolfram_2025_daycount, author="Wolfram Research", title="{DayCount}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DayCount.html}", note=[Accessed: 01-April-2025 ]}

@misc{reference.wolfram_2025_daycount, author="Wolfram Research", title="{DayCount}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DayCount.html}", note=[Accessed: 01-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_daycount, organization={Wolfram Research}, title={DayCount}, year={2014}, url={https://reference.wolfram.com/language/ref/DayCount.html}, note=[Accessed: 01-April-2025 ]}

@online{reference.wolfram_2025_daycount, organization={Wolfram Research}, title={DayCount}, year={2014}, url={https://reference.wolfram.com/language/ref/DayCount.html}, note=[Accessed: 01-April-2025 ]}