Navigation
POST datetime

difference

1 credit

Calculate the time difference between two dates in the chosen unit.

Endpoint

POST /api/v1/tools/datetime/difference

Body Parameters

unit string optional default: "days"
Options: days seconds minutes hours weeks
date_a string required
date_b string required

Example

input Request
{
    "unit": "days",
    "date_a": "2024-01-01",
    "date_b": "2024-01-15"
}
output Response
{
    "unit": "days",
    "difference": 14
}

Response Format

HTTP/1.1 200 OK SUCCESS
{
  "success": true,
  "data": {
    "unit": "days",
    "difference": 14
},
  "meta": {
    "tool": "difference",
    "credits_consumed": 1
  }
}
HTTP/1.1 422 Unprocessable Entity ERROR
{
  "success": false,
  "data": null,
  "error": {
    "code": "validation_error",
    "message": "The given data was invalid."
  }
}

Sign in to try this tool directly from the docs.

Code Examples
Request Example
lightbulb Developer Tip

Credits are deducted before execution. If the upstream tool fails, credits are automatically refunded to your account.