User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
Enter a number or expression like 1000 * 60 * 60 * 24
Presets:
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

JavaScript timing functions like setTimeout and setInterval operate in milliseconds. A value like 86400000 is meaningless at a glance. Misreading a single zero means the difference between a 1‐day cache expiry and a 10‐day one. This tool decomposes any millisecond integer into its human‐readable components: years, months, weeks, days, hours, minutes, seconds, and remaining milliseconds. It uses integer division cascading from the largest applicable unit downward.

The converter supports a "max unit" cap. Setting it to days forces the output to express 604800000 ms as 7 days instead of 1 week. This matches real‐world API documentation patterns where durations are stated in a specific granularity. Note: months are approximated at 30.44 days (average Gregorian month) and years at 365.25 days. For calendar‐precise durations, use a date library.

javascript interval milliseconds human readable time converter duration setTimeout setInterval

Formulas

The decomposition algorithm uses cascading integer division. Given an input T in milliseconds and an ordered list of unit divisors, the value for each unit is extracted sequentially:

qi = floor(Trem รท di)
Trem = Trem โˆ’ qi ร— di

Where qi is the quantity for unit i, di is that unit's divisor in milliseconds, and Trem is the running remainder (initialized to input T). The unit divisors used are:

dyear = 31,557,600,000 ms โ€‚(365.25 ร— 86,400,000)
dmonth = 2,630,016,000 ms โ€‚(30.44 ร— 86,400,000)
dweek = 604,800,000 ms
dday = 86,400,000 ms
dhour = 3,600,000 ms
dminute = 60,000 ms
dsecond = 1,000 ms

Pluralization rule: if qi = 1, use singular form. Otherwise use plural. When a "max unit" is selected, all units above it are excluded from the divisor list, causing their time to accumulate in the highest allowed unit.

Reference Data

UnitAbbreviationMillisecondsExample InputHuman Output
Millisecondms1500500 milliseconds
Seconds1,00010001 second
Minutem60,000650001 minute, 5 seconds
Hourh3,600,00036610001 hour, 1 minute, 1 second
Dayd86,400,000900610001 day, 1 hour, 1 minute, 1 second
Weekw604,800,0006048000001 week
Month (avg)mo2,630,016,00026300160001 month
Year (avg)y31,557,600,000315576000001 year
Common: 1 min timeout - 60,000600001 minute
Common: 5 min debounce - 300,0003000005 minutes
Common: 15 min session - 900,00090000015 minutes
Common: 30 min poll - 1,800,000180000030 minutes
Common: 1 hour cache - 3,600,00036000001 hour
Common: 24 hour expiry - 86,400,000864000001 day
Common: 7 day token - 604,800,0006048000001 week
Common: 30 day cookie - 2,592,000,000259200000030 days
Common: 90 day refresh - 7,776,000,00077760000002 months, 28 days, 3 hours, 27 minutes, 28 seconds
Common: 365 day cert - 31,536,000,0003153600000011 months, 30 days, 2 hours, 24 seconds

Frequently Asked Questions

This tool uses the average Gregorian month of 30.44 days (365.25 รท 12). Actual months range from 28 to 31 days. For calendar-aware calculations (e.g., "from January 15 to March 15"), you need a date-diff library that accounts for variable month lengths and leap years. This tool is designed for duration intervals, not calendar spans.
It caps the largest unit used in decomposition. For example, 604,800,000 ms normally yields "1 week". With max unit set to "days", weeks/months/years are excluded from the divisor chain, so the full value flows into days: "7 days". This is useful when APIs or documentation express durations in a specific granularity like hours or days.
JavaScript's Number.MAX_SAFE_INTEGER is 9,007,199,254,740,991 (2โตยณ โˆ’ 1). This equals approximately 285,616 years. The tool accepts any non-negative integer up to this limit. Values beyond this lose precision due to IEEE 754 floating-point representation. For most real-world intervals (timeouts, cron jobs, cache TTLs), you will never approach this limit.
The tool returns "0 milliseconds" (verbose) or "0ms" (compact). Zero is a valid interval - it's commonly used in setTimeout(fn, 0) to defer execution to the next event loop tick.
Yes. The tool detects multiplication expressions containing only digits, spaces, and the "*" operator, evaluates them safely, and converts the result. This lets you paste intervals directly from source code like "1000 * 60 * 60 * 24 * 7" and get "1 week".
31,536,000,000 ms equals exactly 365 days. But this tool uses the astronomical year of 365.25 days (31,557,600,000 ms) to account for leap years. So 31,536,000,000 ms decomposes to approximately 11 months, 30 days, and residual hours. If you need exactly 365 days = 1 year, set the max unit to "days".