← All tool references

Date & Time · execute

Time Duration Calculator

Measure elapsed time between two date-and-time values in days, clock components, hours, minutes, and seconds.

Open public tool

Overview

Category
Date & Time
API mode
execute
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/time-duration-calculator

View this descriptor as JSON

Execute availability

This tool has an execute route defined by its descriptor. Server-side execution is currently unavailable, so requests return api_not_launched.

POST /api/v1/tools/time-duration-calculator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

start_datetime · string · required
Starting ISO-compatible date and time.
end_datetime · string · required
Ending ISO-compatible date and time.
{
    "type": "object",
    "properties": {
        "start_datetime": {
            "type": "string",
            "description": "Starting ISO-compatible date and time."
        },
        "end_datetime": {
            "type": "string",
            "description": "Ending ISO-compatible date and time."
        }
    },
    "required": [
        "start_datetime",
        "end_datetime"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

days · number
Complete 24-hour periods.
hours · number
Remaining hours.
minutes · number
Remaining minutes.
seconds · number
Remaining seconds.
total_hours · number
Elapsed decimal hours.
total_minutes · number
Complete elapsed minutes.
total_seconds · number
Exact elapsed seconds.
formatted_duration · string
Days and HH:MM:SS display.
{
    "type": "object",
    "properties": {
        "days": {
            "type": "number",
            "description": "Complete 24-hour periods."
        },
        "hours": {
            "type": "number",
            "description": "Remaining hours."
        },
        "minutes": {
            "type": "number",
            "description": "Remaining minutes."
        },
        "seconds": {
            "type": "number",
            "description": "Remaining seconds."
        },
        "total_hours": {
            "type": "number",
            "description": "Elapsed decimal hours."
        },
        "total_minutes": {
            "type": "number",
            "description": "Complete elapsed minutes."
        },
        "total_seconds": {
            "type": "number",
            "description": "Exact elapsed seconds."
        },
        "formatted_duration": {
            "type": "string",
            "description": "Days and HH:MM:SS display."
        }
    },
    "additionalProperties": false
}

An overnight project window

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/time-duration-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "start_datetime": "2026-07-11T09:15:00",
    "end_datetime": "2026-07-12T11:45:00"
}'
{
    "ok": true,
    "data": {
        "slug": "time-duration-calculator",
        "result": {
            "values": {
                "days": 1,
                "hours": 2,
                "minutes": 30,
                "seconds": 0,
                "total_hours": 26.5,
                "total_minutes": 1590,
                "total_seconds": 95400,
                "formatted_duration": "1d 02:30:00"
            },
            "display": {
                "display": "1"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.