
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
100 requests per minute
Endpoints
1 endpoint available
Overview
The Time Between Calculator API calculates the exact time difference between two dates and times. Returns comprehensive breakdowns in multiple time units - from years down to milliseconds.
What You Get
The API returns time differences in all these units simultaneously:
- humanReadable - Natural language summary (e.g., "about 2 years")
- years - Total complete years between dates
- months - Total complete months between dates
- weeks - Total complete weeks between dates
- days - Total days between dates
- hours - Total hours between dates
- minutes - Total minutes between dates
- seconds - Total seconds between dates
- milliseconds - Total milliseconds between dates
Use Cases
- Calculate age or time since an event
- Track project timelines and deadlines
- Calculate employment duration for HR
- Measure time between data points for analytics
- Build countdown or elapsed time features
Endpoints
POST
/v1/tools/time-between-calculatorCalculate time difference between two dates
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| startDate | string | Required | Start date in YYYY-MM-DD format |
| startTime | string | Optional | Start time in HH:mm format (defaults to "00:00") |
| endDate | string | Required | End date in YYYY-MM-DD format |
| endTime | string | Optional | End time in HH:mm format (defaults to "00:00") |
Response Example
{
"success": true,
"result": {
"humanReadable": "about 1 year",
"years": 1,
"months": 12,
"weeks": 52,
"days": 365,
"hours": 8760,
"minutes": 525600,
"seconds": 31536000,
"milliseconds": 31536000000,
"start": "2024-01-01T00:00:00.000Z",
"end": "2025-01-01T00:00:00.000Z"
}
}Error Codes
400
Invalid request body or missing required dates401
Missing or invalid API key422
Invalid date or time format429
Rate limit exceeded500
Internal server errorCode Examples
curl -X POST https://api.opentools.ca/v1/tools/time-between-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"startDate": "2024-01-01",
"startTime": "09:00",
"endDate": "2025-06-15",
"endTime": "17:30"
}'