{
"ok": true,
"data": {
"start": "2026-11-02T00:00:00Z",
"end": "2026-12-01T17:30:00Z",
"timeZone": null,
"direction": "forward",
"totals": {
"seconds": 2568600,
"minutes": 42810,
"hours": 713.5,
"days": 29.729167,
"weeks": 4.247024,
"months": 0,
"years": 0
},
"calendarDays": 29,
"calendar": {
"years": 0,
"months": 0,
"days": 29,
"hours": 17,
"minutes": 30,
"seconds": 0,
"iso": "P29DT17H30M"
},
"businessDays": 20,
"businessDayDetails": {
"convention": "Counts business days after the start date up to and including the end date.",
"weekendDays": [
"Sunday",
"Saturday"
],
"weekendDaysSkipped": 8,
"holidaysSkipped": 1
},
"note": "Inputs without a UTC offset are read in timeZone when given, otherwise as UTC. Calendar math (months, days) runs on wall-clock time; hours, minutes, and seconds are exact elapsed time. totals.months and totals.years are whole calendar units; the other totals are exact elapsed time."
}
}
curl --location --request POST 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40604/difference+between+two+dates' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"start":"2026-11-02","end":"2026-12-01T17:30:00Z","holidays":["2026-11-26"]}'
{
"ok": true,
"data": {
"input": "2024-01-31T00:00:00Z",
"timeZone": null,
"duration": "P1M2DT3H",
"applied": {
"years": 0,
"months": 1,
"weeks": 0,
"days": 2,
"hours": 3,
"minutes": 0,
"seconds": 0
},
"result": "2024-03-02T03:00:00Z",
"resultIso": "2024-03-02T03:00:00Z",
"resultUtc": "2024-03-02T03:00:00.000Z",
"resultDate": "2024-03-02",
"weekday": "Saturday",
"unixTimestamp": 1709348400,
"clamped": true,
"adjustedForDstGap": false,
"note": "Adding months or years clamps to the last valid day of the target month (for example, Jan 31 + 1 month = Feb 28, or Feb 29 in a leap year). Order: years and months, then weeks and days on the wall clock, then hours, minutes, and seconds as exact elapsed time."
}
}
curl --location --request POST 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40605/add+or+subtract+a+duration' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"date":"2024-01-31","duration":"P1M2DT3H"}'
{
"ok": true,
"data": {
"start": "2026-11-25",
"startIsBusinessDay": true,
"days": 3,
"result": "2026-12-01",
"weekday": "Tuesday",
"calendarDaysSpanned": 6,
"weekendDays": [
"Sunday",
"Saturday"
],
"weekendDaysSkipped": 2,
"holidaysSkipped": 1,
"note": "The start date is not counted. Each step moves to the next (or previous, for negative days) date that is not a weekend day or holiday. With days = 0 the start date is returned unchanged. Uses the calendar date of the input; any time or offset is ignored."
}
}
curl --location --request POST 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40606/add+business+days+to+a+date' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"date":"2026-11-25","days":3,"holidays":["2026-11-26"]}'
{
"ok": true,
"data": {
"input": "2026-07-01T12:00:00",
"utc": "2026-07-01T16:00:00.000Z",
"unixTimestamp": 1782921600,
"from": {
"timeZone": "America/New_York",
"localDateTime": "2026-07-01T12:00:00",
"iso": "2026-07-01T12:00:00-04:00",
"offset": "-04:00",
"offsetMinutes": -240,
"isDST": true,
"abbreviation": "EDT",
"formatted": "Wednesday, July 1, 2026 at 12:00:00 PM EDT"
},
"to": {
"timeZone": "Europe/London",
"localDateTime": "2026-07-01T17:00:00",
"iso": "2026-07-01T17:00:00+01:00",
"offset": "+01:00",
"offsetMinutes": 60,
"isDST": true,
"abbreviation": "GMT+1",
"formatted": "Wednesday, July 1, 2026 at 5:00:00 PM GMT+1"
},
"offsetDifferenceMinutes": 300,
"ambiguousLocalTime": false,
"nonexistentLocalTime": false,
"note": "Uses the Intl time zone database of the runtime. A local time repeated by a DST fall-back resolves to the earlier instant; a local time skipped by a spring-forward gap moves forward by the gap."
}
}
curl --location --request POST 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40607/convert+a+date-time+between+time+zones' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"datetime":"2026-07-01T12:00:00","from":"America/New_York","to":"Europe/London"}'
{
"ok": true,
"data": {
"date": "2024-02-29",
"year": 2024,
"month": 2,
"monthName": "February",
"day": 29,
"weekday": "Thursday",
"weekdayNumber": 4,
"isoWeekday": 4,
"isoWeek": 9,
"isoWeekYear": 2024,
"isoWeekDate": "2024-W09-4",
"dayOfYear": 60,
"daysRemainingInYear": 306,
"quarter": 1,
"isLeapYear": true,
"daysInMonth": 29,
"daysInYear": 366,
"isWeekend": false,
"unixTimestamp": 1709164800,
"note": "unixTimestamp is midnight UTC at the start of this date, in seconds."
}
}
curl --location --request GET 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40608/calendar+facts+for+a+date?date=2024-02-29' --header 'Authorization: Bearer YOUR_API_KEY'
{
"ok": true,
"data": {
"input": "P1DT2H3M4.5S",
"normalized": "P1DT2H3M4.5S",
"negative": false,
"components": {
"years": 0,
"months": 0,
"weeks": 0,
"days": 1,
"hours": 2,
"minutes": 3,
"seconds": 4.5
},
"totalSeconds": 93784.5,
"totalSecondsApproximate": false,
"note": "Exact: weeks are 7 days, days are 24 hours (DST shifts are not applied without a start date)."
}
}
curl --location --request POST 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40609/parse+an+iso+8601+duration' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"duration":"P1DT2H3M4.5S"}'
{
"ok": true,
"data": {
"seconds": 5400,
"largestUnit": "hours",
"iso": "PT1H30M",
"components": {
"years": 0,
"months": 0,
"weeks": 0,
"days": 0,
"hours": 1,
"minutes": 30,
"seconds": 0
},
"note": "Months and years are never emitted because their length varies. Seconds are rounded to milliseconds."
}
}
curl --location --request GET 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40610/format+duration+from+query+seconds' --header 'Authorization: Bearer YOUR_API_KEY'
{
"ok": true,
"data": {
"seconds": 93784.25,
"largestUnit": "days",
"iso": "P1DT2H3M4.25S",
"components": {
"years": 0,
"months": 0,
"weeks": 0,
"days": 1,
"hours": 2,
"minutes": 3,
"seconds": 4.25
},
"note": "Months and years are never emitted because their length varies. Seconds are rounded to milliseconds."
}
}
curl --location --request POST 'https://zylalabs.com/api/15186/date+difference+and+business+days+api/40611/format+seconds+as+an+iso+8601+duration' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"seconds":93784.25}'
After signing up, every developer is assigned a personal API access key, a unique combination of letters and digits provided to access to our API endpoint. To authenticate with the Date Difference and Business Days API simply include your bearer token in the Authorization header.
| Header | Description |
|---|---|
Authorization
|
Required
Should be Bearer access_key. See "Your API Access Key" above when you are subscribed.
|
No long-term commitment. Upgrade, downgrade, or cancel anytime. Free Trial includes up to 50 requests.
Date differences, business days with custom weekends and holidays, duration math with month-end clamping, time zone conversion, ISO week info, and ISO 8601 durations.
By default, the count includes business days after the start date, up to and including the end date. A Monday-to-Friday diff is therefore 4, and adding 4 business days to Monday gives Friday, so diff and add agree. Set includeStart to true to also count the start date, as in spreadsheet NETWORKDAYS.
Yes. Pass weekendDays as numbers 0–6 (0 = Sunday) or names such as "Fri" and "Sat". Pass holidays as up to 366 dates in YYYY-MM-DD format. The API does not include a built-in holiday calendar, so you send the dates that apply to you.
The result is clamped to the last valid day of the target month: 2025-02-28, or 2024-02-29 in a leap year. The response sets clamped to true when this happens. Feb 29 plus one year gives Feb 28.
Pass an IANA timeZone to diff or add. Days and months keep the wall-clock time, and hours, minutes, and seconds are exact elapsed time. The spring-forward day in New York is 1 calendar day but 23 hours. Nonexistent local times move forward by the gap, and repeated local times resolve to the earlier instant. Both cases are flagged.
ISO 8601 dates (YYYY-MM-DD) and date-times (YYYY-MM-DDTHH:MM[:SS[.fff]]) with an optional Z or plus/minus HH:MM offset, for years 0001-9999. Values without an offset are read in timeZone when you pass one, otherwise as UTC. Invalid dates such as 2026-02-29 return a 400 with a clear message.
Years and months vary in length, so parse-duration uses averages for them (365.2425 days per year, 30.436875 days per month) and sets totalSecondsApproximate to true. For an exact result, add the duration to a real start date with the add endpoint.
The ISO 8601 week: weeks start on Monday, and week 1 contains the year's first Thursday. For example, 2021-01-03 is in week 53 of week-year 2020. The response includes both isoWeek and isoWeekYear.
Ranges and shifts can be up to 200 years, holiday lists up to 366 dates, business-day steps up to plus or minus 50,000, and request bodies up to 32 KiB. Requests outside these limits return a 400 that names the limit.
It returns the normalized start and end values, direction, exact totals in seconds through weeks, whole calendar months and years, calendar-day count, a calendar breakdown with an ISO duration, and business-day results. Business-day details include the weekend convention and skipped weekend and holiday counts.
The endpoint applies years and months first, then weeks and days using the local wall clock, followed by hours, minutes, and seconds as elapsed time. The response includes the applied components, result in multiple formats, weekday, Unix timestamp, clamping status, and DST-gap adjustment status.
It returns the original date, whether it was a business day, the requested shift, resulting date and weekday, calendar days spanned, weekend configuration, and counts of skipped weekends and holidays. A zero-day shift returns the start date unchanged; the start date is never counted.
The response includes the UTC instant and Unix timestamp, plus source and destination time-zone objects. Each object provides the local date-time, ISO value with offset, offset in minutes, DST flag, abbreviation, and formatted text. It also reports the offset difference and ambiguous or nonexistent local-time flags.
For a date, it returns the weekday, ISO weekday and week date, ISO week and week-year, day of year, remaining days, quarter, leap-year status, days in the month and year, weekend status, and the Unix timestamp for midnight UTC at the start of that date.
The parser returns the original and normalized duration, its sign, and separate years, months, weeks, days, hours, minutes, and seconds components. It also returns total seconds. Totals involving years or months are approximate; weeks, days, and smaller units are exact under fixed-duration rules.
The formatting endpoints return the input seconds, selected largest unit, ISO duration string, and component breakdown. They use weeks, days, hours, minutes, and seconds, never months or years. For example, 5,400 seconds becomes PT1H30M, and fractional seconds are rounded to milliseconds.
Use ISO strings for interoperability, structured components for calculations and display, and Unix timestamps for systems that require epoch seconds. For durations, use the ISO value for storage or transport and components for user-facing labels. Check approximation, clamping, and DST flags before treating results as universally exact.
To obtain your API key, first sign in to your account and navigate to the API you want to use. From the API's Pricing section, choose a plan and complete the subscription process. Once subscribed, return to the API page and you will see your API Access Key displayed at the top of the documentation page. You can use this key to authenticate your requests.
You can’t switch APIs during the free trial. If you subscribe to a different API, your trial will end and the new subscription will start as a paid plan.
The free trial lasts for 7 days and allows you to make up to 50 API requests.
No, the free trial is available only once, so we recommend using it on the API that interests you the most. Most of our APIs offer a free trial, but some may not include this option.
Yes. If the API offers a free trial, you will see a "Free 7-Day Trial" option in its Pricing section. The trial lasts for 7 days and allows up to 50 API requests, enabling you to evaluate the API before subscribing to a paid plan.
Zyla API Hub is like a big store for APIs, where you can find thousands of them all in one place. We also offer dedicated support and real-time monitoring of all APIs. Once you sign up, you can pick and choose which APIs you want to use. Just remember, each API needs its own subscription. But if you subscribe to multiple ones, you'll use the same key for all of them, making things easier for you.
You can monitor your API usage through the response headers included with every request:
x-zyla-api-calls-monthly-used: Shows the total number of API requests you have used during the current billing period.
x-zyla-api-calls-monthly-remaining: Shows the number of API requests you have remaining for the current billing period.
Yes, you can cancel your subscription at any time. Simply go to the Pricing section of the API you're subscribed to and click the "Unsubscribe" button.
Please note that upgrades, downgrades, and cancellations take effect immediately. Once your subscription is canceled, access to the service will end immediately, regardless of any remaining API calls in your quota.
Please have a look at our Refund Policy: https://zylalabs.com/terms#refund