
Time Between Calculator API
Utilities
Calculate time differences between two dates and times instantly. Get results in years, months, days, hours, minutes, and seconds with detailed breakdowns.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
120 requests per minute
Endpoints
1 endpoint available
Overview
Find the time between two dates, with optional times of day. The result, inside data, gives the
total difference in milliseconds, seconds, minutes, hours, days and weeks, the number of whole calendar months
and years, a years/months/days/hours/minutes/seconds breakdown, and a readable sentence.
Notes
- Dates use
YYYY-MM-DD. Times use 24-hourHH:MMorHH:MM:SSand default to00:00. - Dates and times are read as UTC.
data.startanddata.endecho them back as ISO timestamps. - The difference is always positive: swapping start and end gives the same result.
- The totals (seconds to weeks) are rounded down.
monthsandyearscount whole calendar months and years.breakdownandhumanReadableuse average lengths (a year is 365.25 days and a month is 1/12 of that), so they can differ from a calendar count by a day or two.- A date that does not exist (e.g.
2025-02-30) or an impossible time (e.g.25:00) returns 400.
Endpoints
POST
https://opentools.ca/api/v1/tools/time-between-calculatorCalculate the time between two dates and times
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| startDate | string | Required | Start date as YYYY-MM-DD. |
| startTime | string | Optional | Start time as HH:MM or HH:MM:SS (24-hour, UTC).Default: 00:00 |
| endDate | string | Required | End date as YYYY-MM-DD. |
| endTime | string | Optional | End time as HH:MM or HH:MM:SS (24-hour, UTC).Default: 00:00 |
Response Example
{
"success": true,
"data": {
"humanReadable": "2 months, 12 days, 11 hours, and 30 minutes",
"milliseconds": 6337800000,
"seconds": 6337800,
"minutes": 105630,
"hours": 1760,
"days": 73,
"weeks": 10,
"months": 2,
"years": 0,
"start": "2025-01-01T09:00:00.000Z",
"end": "2025-03-15T17:30:00.000Z",
"breakdown": {
"years": 0,
"months": 2,
"days": 12,
"hours": 11,
"minutes": 30,
"seconds": 0
}
}
}Error Codes
400
Invalid request. Validation problems are listed in details.401
Missing or invalid API key403
API key is deactivated or expired, or this IP address is not allowed for the key429
Rate limit exceeded (120 requests per minute per key)500
Internal server errorCode Examples
curl -X POST https://opentools.ca/api/v1/tools/time-between-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"startDate": "2025-01-01",
"startTime": "09:00",
"endDate": "2025-03-15",
"endTime": "17:30"
}'Rather use it in your browser? Open the Time Between Calculator