Skip to content

Time difference


Returns the Difference between 2 timestamps.

GET /api/time/time-difference
Terminal window
https://api.cookie-api.com/api/time/time-difference


URL Parameters
beforeTime period start
afterTime period end


curl --location 'http://api.cookie-api.com/api/time/time-difference?before=in%203%20minutes&after=2024-07-14T17%3A31%3A04Z' \
--header 'Authorization: API_Key'

Responses
{
"days": 0,
"hours": 1,
"human_readable": "0 days, 1 hours, 1 minutes, 3 seconds",
"iso_format": "P0DT1H1M3S",
"microseconds": 3663684364,
"milliseconds": 3663684,
"minutes": 1,
"months": 0,
"nanoseconds": 3663684364000,
"seconds": 3,
"total": {
"days": 0,
"hours": 1,
"minutes": 61,
"seconds": 3663.684364,
"years": 0
},
"years": 0
}