
Date Calculator API
Utilities
Add or subtract days, weeks, months and years from a date, add or count business days with Canadian, US or your own holidays, and find any date's weekday and ISO week.
Authentication
Send your API key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), or in an X-API-Key header.
Rate Limit
120 requests per minute
Endpoints
1 endpoint available
Overview
One endpoint with four operations, chosen by operation:
add: add or subtract years, months, weeks and days fromstartDate.add-business-days: move a number of business days forward or back, skipping days off and holidays.count-business-days: count the business days between two dates.date-info: weekday, ISO week, day of the year, quarter and leap year for a date.
Dates and time zones
- Dates are plain calendar dates written
YYYY-MM-DD, years 0001 to 9999, with no time zone. Nothing shifts with daylight saving. addanddate-inforeport how far the date is from a reference date (daysFromReference, positive when the date is after the reference). If you leave outreferenceDate, it is today's date in UTC on the server. Send it for results that do not change from day to day.
Adding time
Years and months are added first as whole calendar months. If the day does not exist in the target month, it moves to the last day (January 31 plus one month is February 28, or 29 in a leap year) and monthEndAdjusted says so. Weeks and days are then added as exact days.
Business days
- The start date is never counted: 1 business day after a Friday is the next Monday.
daysOfflists weekdays that are not working days, 0 for Sunday to 6 for Saturday. The default is[0, 6]. Foradd-business-daysat least one day must be a working day.holidayPresetadds Canada's federal statutory holidays or US federal holidays, computed for any year. WithuseObservedDatestrue, a holiday on a weekend moves to the day it is observed.customHolidaystakes one holiday per entry, like2026-08-03 Civic Holiday. A date is required and any text after it is the name. Up to 500 entries.count-business-dayscounts both ends by default and accepts dates in either order (datesSwappedtells you). The two dates must be less than 200 years apart.- Holidays that fall on a day off are not counted or skipped, since the day is already off.
Endpoints
POST
https://opentools.ca/api/v1/tools/date-calculatorAdd or subtract time from a date, add or count business days, or look up facts about a date
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| operation | string Enum: add, add-business-days, count-business-days, date-info | Required | What to calculate. |
| startDate | string | Optional | Start date, YYYY-MM-DD. Required for add, add-business-days and count-business-days. |
| endDate | string | Optional | End date, YYYY-MM-DD. Required for count-business-days. |
| date | string | Optional | The date to look up, YYYY-MM-DD. Required for date-info. |
| referenceDate | string | Optional | add and date-info only. The date to compare against. Defaults to today's date in UTC on the server.Default: today (UTC) |
| direction | string Enum: add, subtract | Optional | add and add-business-days only.Default: add |
| years | number | Optional | add only. Whole years, up to 1,000,000.Default: 0 |
| months | number | Optional | add only. Whole months, up to 1,000,000.Default: 0 |
| weeks | number | Optional | add only. Whole weeks, up to 1,000,000.Default: 0 |
| days | number | Optional | add only. Whole days, up to 1,000,000.Default: 0 |
| businessDays | number | Optional | add-business-days only. Whole number, 0 to 100,000.Default: 0 |
| includeStart | boolean | Optional | count-business-days only. Count the start date.Default: true |
| includeEnd | boolean | Optional | count-business-days only. Count the end date.Default: true |
| daysOff | array | Optional | Business-day operations only. Weekdays that are days off, 0 (Sunday) to 6 (Saturday).Default: [0, 6] |
| holidayPreset | string Enum: none, ca-federal, us-federal | Optional | Business-day operations only. Built-in holidays to skip.Default: none |
| useObservedDates | boolean | Optional | Business-day operations only. Use the observed day for holidays that fall on a weekend.Default: true |
| customHolidays | array | Optional | Business-day operations only. Your own holidays as strings like "2026-08-03 Civic Holiday". Up to 500.Default: [] |
Response Example
{
"success": true,
"operation": "add",
"startDate": "2026-01-31",
"direction": "add",
"date": "2026-03-14",
"weekday": "Saturday",
"dayDelta": 42,
"monthEndAdjusted": {
"requestedDay": 31,
"usedDay": 28
},
"referenceDate": "2026-11-25",
"daysFromReference": -256
}Error Codes
400
Bad Request - A date is not a real YYYY-MM-DD date, a custom holiday cannot be read, every day is marked as a day off, the result falls outside years 1 to 9999, or the dates are 200 years or more apart401
Unauthorized - Missing or invalid API key403
Forbidden - The API key is inactive or expired, or the request IP is not allowed405
Method Not Allowed - This endpoint accepts POST only429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)500
Internal Server ErrorCode Examples
# Add one month and two weeks
curl -X POST https://opentools.ca/api/v1/tools/date-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation": "add",
"startDate": "2026-01-31",
"months": 1,
"weeks": 2,
"referenceDate": "2026-11-25"
}'
# Five business days after Dec 18, skipping Canadian holidays
curl -X POST https://opentools.ca/api/v1/tools/date-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation": "add-business-days",
"startDate": "2026-12-18",
"businessDays": 5,
"holidayPreset": "ca-federal"
}'
# Business days in December
curl -X POST https://opentools.ca/api/v1/tools/date-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation": "count-business-days",
"startDate": "2026-12-01",
"endDate": "2026-12-31",
"holidayPreset": "ca-federal"
}'
# Facts about a date
curl -X POST https://opentools.ca/api/v1/tools/date-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation": "date-info",
"date": "2026-12-31",
"referenceDate": "2026-11-25"
}'Rather use it in your browser? Open the Date Calculator