This tool converts a plain number of seconds into a readable phrase such as
2 hours, 34 minutes, 56 seconds. It is handy for displaying job runtimes,
video lengths, cache ages, or any elapsed-time value that would otherwise be an
opaque integer.
When a raw second count is unhelpful
Durations expressed as raw integers are common in data systems but nearly impossible to parse at a glance:
- A video file metadata field saying
duration: 9256tells a human nothing without arithmetic. - A CI/CD pipeline reporting
buildTime: 7382seconds is less useful than “2 hours, 3 minutes, 2 seconds”. - A cache TTL of
2592000becomes “30 days” — a value a non-developer can reason about. - An uptime counter at
31536000is immediately recognisable as “1 year”.
The humanizer solves the translation problem once so you can paste the result into emails, documentation, UI labels, or any context where a raw integer would confuse a reader.
How it works
The total is divided down through a fixed table of units, from largest to smallest, taking the whole-number quotient at each step and carrying the remainder forward:
years = floor(total / 31557600) ; 365.25 days
months = floor(rem / 2629800) ; year / 12
weeks = floor(rem / 604800) ; optional
days = floor(rem / 86400)
hours = floor(rem / 3600)
minutes = floor(rem / 60)
seconds = rem
Only units with a non-zero value are shown, and the list is truncated to the maximum number of parts you choose. Because the higher units use average lengths (365.25 days per year), the result stays accurate over long spans without anchoring to a calendar.
Example and tips
9296 seconds becomes 2 hours, 34 minutes, 56 seconds, or 2 hours, 34 minutes
if you cap the output at two parts. For a friendly summary on a dashboard, keep
the maximum at 2 or 3 parts; for an exact breakdown, raise it to 7. The minus
sign on negative inputs lets you reuse the same tool for both countdowns and
elapsed time.
Choosing the number of parts
The “max parts” setting controls how precise versus how readable the output is:
| Max parts | Example output for 9,296 s | Good for |
|---|---|---|
| 1 | 2 hours | High-level dashboards, status pages |
| 2 | 2 hours, 34 minutes | Most UI labels and notifications |
| 3 | 2 hours, 34 minutes, 56 seconds | Log entries, time-tracking reports |
| 7 | 2 hours, 34 minutes, 56 seconds | Complete breakdown (rarely needed) |
Leading units with a zero value are omitted automatically. A duration of 45 seconds shows as 45 seconds at max-parts 2, not 0 hours, 0 minutes, 45 seconds.
Including or excluding weeks
Weeks are optional because they sit awkwardly between days and months in everyday language. Most English speakers think in “days” rather than “weeks” for durations under a month, and “months” rather than “weeks” for durations over three weeks. Turn weeks on when you specifically need to express durations like “3 weeks, 2 days” rather than “23 days” — common in project scheduling contexts where weekly sprints are meaningful.