Time Duration Calculator API
Hours worked between two clock times minus a break (crossing midnight if needed), or the total of a list of durations, as h/m, H:MM and decimal hours.
POST /api/v1/tools/time-duration-calculatorMCP time_duration_calculatorTime & DateWork out the hours and minutes between two times, overnight shifts included, subtract breaks, add up a list of durations, and convert to decimal hours.
Input
Send these as a JSON object. Unknown fields are rejected.
- mode
- between: time from start to end minus break. sum: add up a list of durations. (string, one of between, sum, default "between")
- start
- between: start time, e.g. "09:15" or "9:15 am". (string, up to 12 characters)
- end
- between: end time; if earlier than start it is taken as the next day, e.g. "17:45". (string, up to 12 characters)
- break
- between: optional unpaid break, e.g. "30m", "0:30" or "1h 15m". (string, up to 40 characters)
- durations
- sum: one duration per line, e.g. "7:30", "1h 15m", "45 min", "7.5h"; prefix a line with "-" to subtract. A bare number is rejected (hours or minutes is ambiguous). (string, up to 50000 characters)
curl https://pithlab.com/api/v1/tools/time-duration-calculator \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"mode":"between","start":"09:15","end":"17:45","break":"30m"}'Example response
{
"ok": true,
"result": {
"seconds": 28800,
"hm": "8h 00m",
"clock": "8:00",
"decimalHours": 8,
"spanSeconds": 30600,
"breakSeconds": 1800,
"crossesMidnight": false,
"text": "8h 00m = 8.00 hours"
}
}