← All tool references

Date & Time · execute

Hours Calculator

Calculate paid or elapsed shift time between two clock times after deducting an optional break.

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/hours-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/hours-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_time · string · required
Enter the clock-in or starting time in HH:MM format.
end_time · string · required
Enter the clock-out or ending time in HH:MM format.
break_minutes · number · required
Enter the unpaid break minutes to subtract from the shift length.
{
    "type": "object",
    "properties": {
        "start_time": {
            "type": "string",
            "description": "Enter the clock-in or starting time in HH:MM format."
        },
        "end_time": {
            "type": "string",
            "description": "Enter the clock-out or ending time in HH:MM format."
        },
        "break_minutes": {
            "type": "number",
            "description": "Enter the unpaid break minutes to subtract from the shift length."
        }
    },
    "required": [
        "start_time",
        "end_time",
        "break_minutes"
    ],
    "additionalProperties": false
}

Output schema

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

decimal_hours · number
Browser-calculated decimal hours.
hours · number
Elapsed hours.
minutes · number
Total minutes.
{
    "type": "object",
    "properties": {
        "decimal_hours": {
            "type": "number",
            "description": "Browser-calculated decimal hours."
        },
        "hours": {
            "type": "number",
            "description": "Elapsed hours."
        },
        "minutes": {
            "type": "number",
            "description": "Total minutes."
        }
    },
    "additionalProperties": false
}

Workday with a 30-minute break

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/hours-calculator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "start_time": "09:00",
    "end_time": "17:30",
    "break_minutes": 30
}'
{
    "ok": true,
    "data": {
        "slug": "hours-calculator",
        "result": {
            "values": {
                "decimal_hours": 8,
                "hours": 8,
                "minutes": 480
            },
            "display": {
                "display": "8"
            },
            "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.