GET/v1/date/diff
Days, weeks, months and business days between two dates
Business days count both ends when they are working days (like Excel's NETWORKDAYS). With country, public holidays are excluded too; without it, only the weekend is.
PARAMETERS
- fromquery · stringREQUIRED
- Start datee.g. 2026-12-18
- toquery · stringREQUIRED
- End datee.g. 2027-01-05
- countryquery · string
- Country for holidays and weekend definitione.g. US
- subdivisionquery · string
- State / province for regional holidayse.g. string
REQUEST
curl "https://api.apialmanac.com/v1/date/diff?from=2026-12-18&to=2027-01-05" \ -H "X-API-Key: YOUR_KEY"
import requests
r = requests.get("https://api.apialmanac.com/v1/date/diff?from=2026-12-18&to=2027-01-05", headers={"X-API-Key": "YOUR_KEY"})
print(r.status_code, r.headers.get("X-Gw-Remaining"))
print(r.json())
const r = await fetch("https://api.apialmanac.com/v1/date/diff?from=2026-12-18&to=2027-01-05", {
headers: { "X-API-Key": "YOUR_KEY" }
});
console.log(r.status, r.headers.get("X-Gw-Remaining"));
console.log(await r.json());
RESPONSE
200OK
{
"from": "2026-12-18",
"to": "2027-01-05",
"days": 18,
"weeks": 2.57,
"calendar": {
"years": 0,
"months": 0,
"days": 18
},
"business_days": 11,
"weekend_days": 6,
"holiday_days": 2,
"calendar_used": "United States",
"holidays": [
{
"date": "2026-12-25",
"name": "Christmas Day"
},
{
"date": "2027-01-01",
"name": "New Year's Day"
}
]
}