Conversion Utilities

Seconds To Hms

Converts raw seconds into readable hours:minutes:seconds format. Use via MCP in Cursor or REST API at /v1/convert/time/seconds-to-hms. Pass 3661 seconds, get "1:01:01" back. Perfect for AI agents processing timestamps, durations, or media files without floating-point rounding errors.

API Endpoint

GET /v1/convert/time/seconds-to-hms

Code Examples

curl "https://tinyfn.io/v1/convert/time/seconds-to-hms" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/convert/time/seconds-to-hms', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/convert/time/seconds-to-hms',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's conversion tools:

{
  "mcpServers": {
    "tinyfn-conversion": {
      "url": "https://tinyfn.io/mcp/conversion",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I convert seconds to hours minutes seconds format?

Send seconds as a parameter to GET /v1/convert/time/seconds-to-hms. Returns H:MM:SS format like "2:30:45" for 9045 seconds.

What format does seconds to HMS conversion return?

Returns H:MM:SS or HH:MM:SS format. Minutes and seconds are zero-padded to 2 digits, hours show actual value without padding.

Can MCP tools convert large second values to time format?

Yes, handles any positive integer. 86400 seconds becomes "24:00:00", 3661 becomes "1:01:01". No upper limit on hours.

Does seconds to HMS handle decimal or fractional seconds?

Designed for whole seconds only. Decimals are typically truncated or rounded depending on implementation.

How is this different from manual time calculation in code?

Provides consistent formatting and handles edge cases deterministically. Eliminates common bugs with modulo operations and zero-padding.

Try Seconds To Hms Now

Get your free API key and start using Seconds To Hms in seconds.

Get Free API Key