Add Business Days API: Calculate Working Days Accurately

Need to calculate dates that exclude weekends and holidays? This guide shows you how to use the Add Business Days API to perform accurate working day calculations for due dates, delivery estimates, and SLA deadlines.

What are Business Days?

Business days (also called working days or weekdays) are the days of the week when most businesses operate, typically Monday through Friday. Business day calculations exclude weekends (Saturday and Sunday) and optionally public holidays.

For example, if today is Friday and you need to add 3 business days, the result would be Wednesday (skipping Saturday and Sunday).

Handling Holidays

Holidays vary by country, region, and even company. The API supports multiple approaches:

  • No holidays: Only exclude weekends
  • Country holidays: Use built-in holiday calendars for specific countries
  • Custom holidays: Provide your own list of holiday dates
Supported Countries: The API includes holiday calendars for US, UK, Canada, Australia, Germany, France, and many more. Check the documentation for the full list.

Using the Add Business Days API

TinyFn provides a flexible endpoint for business day calculations:

API Request
GET https://api.tinyfn.io/v1/time/add-business-days
Headers: X-API-Key: your-api-key
Response
{
  "original": "2024-01-12T00:00:00.000Z",
  "result": "2024-01-17T00:00:00.000Z",
  "business_days_added": 3,
  "calendar_days_spanned": 5,
  "weekends_skipped": 2,
  "holidays_skipped": 0,
  "holidays_skipped_list": []
}

Parameters

Parameter Type Description
date string Starting date in ISO 8601 format (required)
days integer Number of business days to add. Use negative to subtract. (required)
country string Country code for holiday calendar (e.g., "US", "GB", "DE")
holidays array Custom holiday dates as ISO strings (overrides country holidays)

Code Examples

JavaScript / Node.js

const response = await fetch(
  'https://api.tinyfn.io/v1/time/add-business-days?' + new URLSearchParams({
    date: '2024-01-12',
    days: 5,
    country: 'US'
  }),
  { headers: { 'X-API-Key': 'your-api-key' } }
);
const result = await response.json();
console.log(result.result); // 2024-01-19T00:00:00.000Z
// Note: MLK Day (Jan 15) may be skipped if included in US holidays

Python

import requests

# Using custom holidays
response = requests.get(
    'https://api.tinyfn.io/v1/time/add-business-days',
    params={
        'date': '2024-12-20',
        'days': 5,
        'holidays': ['2024-12-25', '2024-12-26', '2025-01-01']
    },
    headers={'X-API-Key': 'your-api-key'}
)
result = response.json()
print(result['result'])  # Skips Christmas, Boxing Day, and New Year's
print(result['holidays_skipped_list'])

cURL

curl "https://api.tinyfn.io/v1/time/add-business-days?date=2024-01-12&days=10&country=GB" \
  -H "X-API-Key: your-api-key"

Common Use Cases

  • Shipping Estimates: Calculate delivery dates excluding weekends
  • Payment Due Dates: Set invoice due dates in business days
  • SLA Deadlines: Track response times in business hours/days
  • Project Planning: Estimate task completion dates
  • Legal Deadlines: Calculate court filing or response deadlines

Best Practices

  1. Always specify country: Holiday calendars vary significantly by region
  2. Update holiday lists: If using custom holidays, keep them current
  3. Consider regional holidays: Some holidays are regional (e.g., state holidays in the US)
  4. Handle edge cases: What if the start date is a weekend or holiday?

Try the Add Business Days API

Get your free API key and simplify your business day calculations.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key