Date difference
date_diffCalculate days, weeks, months, or business days between two dates or datetimes, excluding weekends and public holidays. Use it for age, tenure, countdowns, notice periods, and working days until a deadline.
Instructions
How many days, weeks, months or business days between two dates or datetimes: calendar (Y/M/D), totals, and business days (weekdays in [from, to) minus holidays; pass country to exclude its public holidays). Use for age, tenure, countdowns, notice periods and working days until a deadline. First 25 calls per day are free, then $0.001 per call (x402).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | YYYY-MM-DD, or ISO 8601 datetime with Z or offset | |
| from | Yes | YYYY-MM-DD, or ISO 8601 datetime with Z or offset | |
| country | No | ISO 3166-1 alpha-2 country code (207 countries); its public holidays (2000–2050) are excluded from business days | |
| holidays | No | Extra dates excluded from business-day counts (rest days from workdays are always excluded) | |
| workdays | No | Working days of the week, 0 = Sunday. Default [1,2,3,4,5] (Mon–Fri); e.g. [0,1,2,3,4] for Sun–Thu or [1,2,3,4,5,6] for Mon–Sat |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | ||
| from | Yes | ||
| calendar | Yes | ||
| direction | Yes | ||
| total_days | Yes | ||
| total_hours | No | Datetime inputs only | |
| total_weeks | Yes | ||
| iso_duration | Yes | ||
| business_days | No | Weekdays in [from, to) minus holidays (date inputs only) | |
| total_minutes | No | ||
| total_seconds | No |