Count days between dates
count_daysUse for any 'how many days between two dates' question: plain date difference, age or duration, or business days. By default, counts all calendar days, including the earlier date and excluding the later date. For business days, set excludeWeekdays, for example [0,6] for Saturday and Sunday. To also skip public holidays, set excludeHolidays and country, and region for a regional calendar. To check if one date is a working day, use the same date as start and end with includeEnd true: days is 1 or 0. Plain reversed dates give a negative count; filtered counts are never negative. If holiday data is unavailable, the call fails. Returns the count, weekday and ISO week of both dates, elapsed years, months and days for plain counts, warnings to read, the rules used and a share link.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"start": "<start>",
"end": "<end>"
},
"name": "count_days"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | Yes | Second date of the range. The later of start and end is counted only when includeEnd is true. An end before start makes a count with no exclusions negative. | |
| start | Yes | First date of the range, as year, month and day, for example 2027-01-15. The earlier of start and end is always counted. | |
| region | No | Region of country, to also exclude its regional public holidays: the exact code that list_locations gives for the country. Omit it to use only the national calendar. | |
| country | No | Country whose public holidays excludeHolidays removes, as its code from list_locations, for example US or DE. Necessary when excludeHolidays is true or region is set. | |
| language | No | Language of the Date Calculator page that shareUrl opens. The call fails when that page does not offer the country. nb and no, zh-Hans and zh-cn, and zh-Hant and zh-tw are the same language. Weekday names and warnings in the result are always English. | en |
| includeEnd | No | Set true to count the later date too, so that both dates are in the count. | |
| excludeHolidays | No | Exclude public holidays, including observed dates, as full days. The data does not mark half-day holidays. Requires country; unavailable holiday data is an error. | |
| excludeWeekdays | No | Weekdays that do not count, as numbers: 0 is Sunday, 1 is Monday, and so on to 6 for Saturday. Use [0,6] for a Saturday and Sunday weekend; some countries have a different weekend, so choose the days for the country. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Always true. An error result has no structured content. | |
| days | Yes | The answer: the days in the range that are not excluded. Negative only when end is before start and nothing is excluded. | |
| rules | Yes | The inputs as the calculation applied them, with defaults filled in, and the rules it followed in words. country is the country that was sent, or null. | |
| weeks | No | The same span in weeks, to 2 decimals. Only with no exclusion. | |
| years | No | The same span in years, to 2 decimals. Only with no exclusion. | |
| months | No | The same span in months, to 2 decimals. Only with no exclusion. | |
| elapsed | No | The span between the two dates as whole years, months and days, for an age or a duration. Never negative. Only with no exclusion. | |
| endDate | Yes | The end input with its weekday and ISO week. | |
| filtered | Yes | True when a weekday or holiday exclusion applied to the count. | |
| shareUrl | Yes | Link that opens this calculation in the Date Calculator on onlinealarmkur.com. | |
| warnings | Yes | English notes that change how to read the result; tell the user about them. Empty when there are none. | |
| startDate | Yes | The start input with its weekday and ISO week. | |
| holidayData | Yes | Source, version and coverage of the holiday data that the calculation used. Null when it used no holiday data. | |
| calendarDays | Yes | All calendar days in the range, before exclusions. Equal to days with no exclusion. | |
| excludedDays | Yes | Days in the range that the weekday and holiday exclusions removed. 0 with no exclusion. | |
| excludedHolidayDates | Yes | Public holidays in the range that were excluded and that are not on an excluded weekday. |