Skip to content
gohacks.dev
Performance

Duration and TTL Converter

Convert a duration between seconds, minutes, hours and days, HH:MM:SS, ISO 8601 (PT1H30M), Go duration syntax and plain English, for TTLs and timeouts.

Free · No sign-up · Your inputs stay in your browser

Input

Convert a duration between formats

Output

1 hour, 30 minutes

Seconds5,400
Milliseconds5,400,000
Minutes90
Hours1.5
Days0.063
HH:MM:SS01:30:00
ISO 8601PT1H30M
Go time.Duration1h30m0s
Human1 hour, 30 minutes

ISO 8601 months and years have no fixed length; here a month counts as 30 days and a year as 365, which is fine for TTLs and wrong for calendars. Laravel's cache, session and queue settings take seconds or minutes depending on the key (SESSION_LIFETIME is minutes), so check the unit before pasting.

Runs in this browser. Nothing you paste is sent to a server.

Check the unit before pasting

Configuration files disagree about units. Laravel's Cache::put() takes seconds, SESSION_LIFETIME takes minutes, Redis EXPIRE takes seconds and PEXPIRE milliseconds, Nginx accepts 30s or 5m, and Kubernetes probes take seconds. A TTL off by a factor of 60 is one of the most common caching bugs.

ISO 8601 durations

The format is P, then years, months, weeks and days, then T and hours, minutes and seconds: PT15M is fifteen minutes and P1M one month. Months and years have no fixed length, so a converter has to assume one; this one uses 30 and 365 days. PHP's DateInterval and Java's Duration parse the format, as does the schema.org structured data for videos and recipes.

Share

Frequently asked questions

How many seconds are in a day?
86,400. A week is 604,800 and a 30-day month 2,592,000.
What does PT1H30M mean?
An ISO 8601 duration of 1 hour and 30 minutes. P starts the duration and T separates the date part from the time part.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools