Format duration

Decompose a signed millisecond duration into fixed 24-hour days and smaller remainder units.

freeworks offlinenothing uploaded
ToolDuration Formatter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The absolute number divides by 86,400,000 ms, then remainder arithmetic yields hours, minutes, seconds, and milliseconds. Zero leading units disappear and one minus sign prefixes the full formatted result.

  • Milliseconds are the sole input unit, avoiding a unit guess.
  • A day means exactly 24 elapsed hours rather than a timezone-aware civil date.

Worked example

Format Milliseconds
Convert 90061000 milliseconds to a human-readable duration
Input
											90061000
										
Output
												Input: 90061000 ms
Formatted: 1 day, 1 hour, 1 minute, 1 second

Breakdown:
  Days:         1
  Hours:        1
  Minutes:      1
  Seconds:      1
  Milliseconds: 0
											

When to use this

Performance traces show runtimes, retry settings become readable, and test reports retain the sign of timing deltas.

Edge cases

  • 90,061,000 ms becomes 1 day, 1 hour, 1 minute, 1 second with its zero millisecond remainder omitted.
  • -1,500 ms becomes -1 second, 500 ms rather than repeating a minus on each component.
  • A daylight-saving transition does not change the fixed 86,400,000 ms day.