User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
Category Time
Enter a positive number. Supports decimals for sub-millisecond precision.
Presets:
Compact Show only the first unit
Verbose Full-length unit names
Colon Notation Display as H:MM:SS
Sub-Milliseconds Show µs and ns
Separate Milliseconds Don’t merge ms into seconds
Keep Decimals Show .0 on whole seconds
Hide Year Convert years to days
Hide Year & Days Collapse to hours
Hide Seconds Omit seconds from output
Sub-Seconds as Decimals 900ms → 0.9s
Enter milliseconds above to convert
Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

About

Raw millisecond values are ubiquitous in software logs, performance profiling, API response headers, and process.hrtime output. Misreading 1337000000ms as "about 13 million seconds" instead of the correct 15d 11h 23m 20s leads to incorrect timeout configurations, flawed SLA reports, and misdiagnosed latency bottlenecks. This converter decomposes any millisecond value - including sub-millisecond precision down to nanoseconds - into human-parseable duration strings using cascading integer division through time units from years (365.25 days) down to nanoseconds. It replicates the full API surface of the pretty-ms specification: compact mode, verbose labels, colon notation for digital-clock style, configurable decimal digits, unit count limits, and independent control over year, day, and second visibility. The tool assumes fixed-length days (86400s) and years (365.25d); it does not account for leap seconds or calendar irregularities because it formats durations, not calendar dates.

milliseconds time converter human readable time pretty ms duration formatter time duration ms to time

Formulas

The conversion decomposes a millisecond value t through cascading integer division across fixed time-unit boundaries:

years = t31557600000

days = t mod 3155760000086400000

hours = t mod 864000003600000

minutes = t mod 360000060000

seconds = t mod 600001000

ms = t mod 1000

Where the constants derive from: 1y = 365.25 Γ— 24 Γ— 3600 Γ— 1000 = 31557600000ms. For sub-millisecond decomposition with formatSubMilliseconds enabled: ΞΌs = floor(fractional_ms Γ— 1000) and ns = floor(fractional_ΞΌs Γ— 1000). Each unit extraction uses floor division; the remainder cascades to the next smaller unit. The colonNotation mode formats as H:MM:SS with zero-padded minutes and seconds, always showing at least M:SS.

Reference Data

Millisecond ValueDefault OutputCompactVerboseColon Notation
500500ms500ms500 milliseconds0:00.5
13371.3s1s1.3 seconds0:01.3
50005s5s5 seconds0:05
600001m1m1 minute1:00
955001m 35.5s1m1 minute 35.5 seconds1:35.5
36000001h1h1 hour1:00:00
864000001d1d1 day24:00:00
133566900015d 11h 1m 9s15d15 days 11 hours 1 minute 9 seconds371:01:09
315576000001y1y1 year8766:00:00
1004000801d 3h 53m 20s1d1 day 3 hours 53 minutes 20 seconds27:53:20
0.00050ms0ms0 milliseconds0:00
100.40008 (sub-ms)100ms100ms100 milliseconds0:00.1

Frequently Asked Questions

Duration formatting uses the Julian year convention of 365.25 days (31557600000ms) to account for leap years averaged over a four-year cycle. This matches the SI definition of the Julian year used in astronomical and scientific contexts. Calendar-specific year lengths (365 or 366 days) are irrelevant for duration math because durations measure elapsed time, not calendar spans.
JavaScript floating-point arithmetic (IEEE 754 double precision) introduces rounding artifacts below 1ms. The converter mitigates this by rounding intermediate microsecond and nanosecond values to the nearest integer after multiplication by 1000. Input values like 100.400080 yield 100ms 400ΞΌs 80ns when formatSubMilliseconds is enabled. Without that flag, the fractional milliseconds are silently truncated.
Compact mode (compact = TRUE) forces exactly one unit and zeroes all decimal digits, e.g., 1337000000ms becomes 15d. The unitCount option lets you specify any number of units to display, e.g., unitCount = 2 yields 15d 11h. Setting compact overrides unitCount.
Yes. Colon notation does not cap hours at 24. A value of 1335669000ms renders as 371:01:09, not as days plus hours. This mimics digital stopwatch behavior where the hour counter accumulates without rolling over into days.
With hideYear enabled, years are converted to their equivalent days (365.25 per year) and added to the day count: 1y 3d becomes 368d. With hideYearAndDays, both years and days collapse into hours: 1y 3d 5h becomes 8837h. This is useful for engineering contexts where only hours-level granularity matters.
By default, a value of exactly 13000ms shows as 13s (trailing .0 is stripped). Enabling keepDecimalsOnWholeSeconds preserves the decimal: 13.0s. The number of zeros shown matches secondsDecimalDigits. With secondsDecimalDigits = 3, it would show 13.000s. This prevents UI width jitter in progress displays.