Misc

Calculate Date Difference

0calls
Free

Need to know how long is between two dates? This endpoint computes the precise difference.

Overview

Given a start date and an end date, the endpoint returns the difference in total days, hours, minutes, seconds, and weeks, plus a human-readable string (e.g. "1 year 2 months 3 days").

Date formats

Common formats are auto-detected, including YYYY-MM-DD, YYYY/MM/DD, DD-MM-YYYY, and ISO 8601 (with time-zone). You can also pass an explicit format (e.g. DD-MM-YYYY).

Note

When the end date precedes the start date, the returned values are negative.

Request body

start_date
stringrequired

Start date. Supports auto-detection of common formats.

end_date
stringrequired

End date. Supports auto-detection of common formats.

format
stringoptional

Date format (optional), e.g. DD-MM-YYYY. Auto-detected when omitted.

Response

200 / OK

Success. Returns the difference in multiple units.

JSON

400 / Bad Request

Failed to parse a date, or invalid parameters.

JSON