Working Days Calculator
Calculate the number of working days (business days) between two dates, with optional support for country-specific holidays. Useful for project planning, delivery estimates, and scheduling.
Overview
Use Cases
- Project deadline calculations
- Delivery time estimates
- Payroll and billing calculations
- Service level agreement (SLA) tracking
- Vacation and leave planning
Features
API Endpoints
Calculate Working Days
Calculate the number of working days between two dates, optionally accounting for country-specific holidays
https://api.requiems.xyz/v1/places/working-days
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| from | string |
Required | Start date in YYYY-MM-DD format (ISO 8601) |
| to | string |
Required | End date in YYYY-MM-DD format (ISO 8601). Must be >= from date. |
| country | string |
Optional | ISO 3166-1 alpha-2 country code (e.g., "US", "GB", "FR"). When provided, country-specific holidays are excluded from working days count. |
| subdivision | string |
Optional | ISO 3166-2 subdivision code for state/region within the country (e.g., "NY" for New York, "CA" for California). Only used when country is provided. |
Try it out
Live DemoRequest
Start date in YYYY-MM-DD format (ISO 8601)
End date in YYYY-MM-DD format (ISO 8601). Must be >= from date.
ISO 3166-1 alpha-2 country code (e.g., "US", "GB", "FR"). When provided, country-specific holidays are excluded from working days count.
ISO 3166-2 subdivision code for state/region within the country (e.g., "NY" for New York, "CA" for California). Only used when country is provided.
Response Fields
| Field | Type | Description |
|---|---|---|
| working_days | integer |
Number of working days between the two dates (excluding weekends and optionally holidays) |
| from | string |
Start date (echoed from request) |
| to | string |
End date (echoed from request) |
| country | string |
Country code (echoed from request, empty string if not provided) |
| subdivision | string |
Subdivision code (echoed from request, empty string if not provided) |
Code Examples
# Without country (only excludes weekends)
curl "https://api.requiems.xyz/v1/places/working-days?from=2024-02-23&to=2024-02-28" \
-H "requiems-api-key: YOUR_API_KEY"
# With country (excludes weekends and US federal holidays)
curl "https://api.requiems.xyz/v1/places/working-days?from=2024-02-23&to=2024-02-28&country=US" \
-H "requiems-api-key: YOUR_API_KEY"
# With country and subdivision (excludes weekends and US + NY holidays)
curl "https://api.requiems.xyz/v1/places/working-days?from=2024-02-23&to=2024-02-28&country=US&subdivision=NY" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://api.requiems.xyz/v1/places/working-days"
headers = {"requiems-api-key": "YOUR_API_KEY"}
params = {
"from": "2024-02-23",
"to": "2024-02-28",
"country": "US",
"subdivision": "NY"
}
response = requests.get(url, headers=headers, params=params)
result = response.json()['data']
print(f"{result['working_days']} working days")
const params = new URLSearchParams({
from: '2024-02-23',
to: '2024-02-28',
country: 'US',
subdivision: 'NY'
});
const response = await fetch(
`https://api.requiems.xyz/v1/places/working-days?${params}`,
{
headers: {
'requiems-api-key': 'YOUR_API_KEY'
}
}
);
const { data } = await response.json();
console.log(`${data.working_days} working days`);
require 'net/http'
require 'json'
uri = URI('https://api.requiems.xyz/v1/places/working-days')
uri.query = URI.encode_www_form(
from: '2024-02-23',
to: '2024-02-28',
country: 'US',
subdivision: 'NY'
)
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)['data']
puts "#{data['working_days']} working days"
Error Responses
bad_request
The from and to parameters are required, or to date is before from date, or invalid date format