Time Utilities

Duration Converter

Convert between seconds/milliseconds and days, hours, minutes, seconds.

What is Duration Calculator?

Duration calculator converts between different time units and calculates time spans.

Supported Units

  • Milliseconds, Seconds, Minutes
  • Hours, Days, Weeks
  • Months, Years

Use Cases

  • Time estimation
  • Performance measurement
  • Scheduling calculations

This converter turns a count of seconds or milliseconds into a day, hour, minute and second breakdown, and adds the four fields back into one total. It covers pure time quantities: media runtimes, request latency, cache TTLs and summed task durations. No date, timezone or calendar logic is involved, so every unit is a fixed multiple of the second.

Where the sub-second remainder goes

Value → Duration mode parses the input with parseInt, multiplies by 1000 when the unit is seconds, then splits the result with four integer operations: floor(sec / 86400) for days, floor(sec % 86400 / 3600) for hours, floor(sec % 3600 / 60) for minutes and sec % 60 for seconds. That seconds term is a whole count of Math.floor(ms / 1000), so everything below one second is discarded from the breakdown, while the Total line still prints the raw millisecond value. Entering 1500 with milliseconds selected yields 0 days 0 hours 0 minutes 1 seconds beside Total 1500 milliseconds. Because parseInt truncates instead of rounding, a typed 1.9 counts as one second. For latency or frame-accurate work, read the Total figure.

86400 assumes the SI day, not a calendar day

The divisor chain 86400 / 3600 / 60 treats a day as exactly 86,400 seconds, which is how the SI second and the day relate: since 1967 the second is defined by the caesium-133 hyperfine transition, and the day used for this arithmetic is 86,400 of them. The result is therefore independent of date, timezone and daylight-saving shifts, so 100000 seconds is always 1 days 3 hours 46 minutes 40 seconds. It also hides leap seconds: IERS inserts them into UTC to keep it within 0.9 s of UT1, so a real UTC day that ends in 23:59:60 lasts 86,401 SI seconds and no input here reproduces that extra second. Constants are the right model for runtimes, TTLs and summed task time; anything that must land on a wall clock belongs in date-calculator or timestamp.

The printed label is not an ISO 8601 duration

ISO 8601 writes a duration as P1DT1H1M1S: a P prefix, the date part before T and the time part after it. This tool prints localised unit labels, so its output cannot be pasted into a field that validates that grammar. Two ISO rules break hand-built strings. M means months before T and minutes after it, so PT1M is one minute while P1M is roughly thirty days. And the W week designator may not be mixed with D, H, M or S: P1W2D is invalid and must be written P9D. Zero units are normally omitted, so two whole hours is PT2H, never PT2H0M0S.

Worked example

One hundred thousand seconds, both directions

Input
100000, unit seconds (Value → Duration)
Output
1 days 3 hours 46 minutes 40 seconds
Total 100000000 milliseconds

86400 + 3 × 3600 + 46 × 60 + 40 = 100000, so the breakdown is exact and no remainder is dropped; 100000 × 1000 is the Total line. Feeding 1 day, 3 hours, 46 minutes and 40 seconds back into Duration → Value returns the same 100000 seconds.

Limits and pitfalls

  • Input is parsed with parseInt and stored as a double, so seconds are whole numbers only: 1.9 is truncated to 1, and beyond about 15 significant digits (for example 9007199254740993) the kept value is already imprecise.
  • The breakdown stops at whole seconds, so 999 milliseconds displays 0 days 0 hours 0 minutes 0 seconds; the Total line is the only place sub-second data survives.
  • A negative value renders nothing at all — the result panel disappears instead of showing an error — while 0 still prints a zero breakdown.
  • Duration → Value multiplies each field by its own constant and adds them without carrying, so 25 hours plus 61 minutes reports 93660 seconds under the label 25 hours 61 minutes.
  • The seconds/milliseconds selector exists only in Value → Duration mode; the reverse direction always answers in seconds, with milliseconds derived as seconds × 1000.

Related tools

Whether this splitter is the right stop, or something that already knows the unit

What you are holdingThis pageWhat does it better
One bare number — a timeout, a TTL, a media runtimeType 2700, leave the dropdown on seconds, and the panel reads 0 days 0 hours 45 minutes 0 seconds with Total 2700000 milliseconds underneath. One field in, two readings out, no date and no timezone involved.Excel stores the same number as a fraction of a day: put 2700 in a cell formatted [h]:mm:ss and it shows 00:45:00, and it keeps counting past 24 hours (100000 → 27:46:40). What Excel will not do is write the word "days", so you still need =INT(A1) and the remainder arithmetic. Stay here when the output is text you read; go to a spreadsheet when the input is a column.
The span arrives as text with units attached — 1h30m, 90sDuration → Value is four number boxes, not a text parser. You split 1h30m into 1 and 30 yourself, and a stray letter typed into a box is not rejected — it just drops out of the total as 0.Go’s time.ParseDuration("1h30m") returns that span as an int64 nanosecond count, 5400000000000, and its ceiling is about 2562047h47m16.854775807s. Kubernetes duration fields accept the same grammar, and systemd takes TimeoutStartSec=90s. Choose a parser as soon as the string is machine input rather than something you retype.
The span has to land on a wall clock — "what time is it 90 minutes from now"There is no now, no calendar date and no UTC offset on this page, so 90 minutes is always 5400 seconds whether or not a month boundary or a daylight-saving switch falls inside it.Use the timestamp tool for epoch arithmetic and the date calculator for calendar-day differences. Only those know that local clocks skip or repeat a stretch of wall time, which is why "90 minutes from 01:30" is a calendar question the second count cannot answer.
The answer goes into a config file, not a pair of human eyesWhat you copy is a label — 1 hours 1 minutes 1 seconds — while the only machine-readable figure on the panel is the whole-second total. The reverse direction always prints plain seconds, never a suffixed form like 3661s.Add the suffix by hand: Nginx reads proxy_read_timeout 90s, systemd reads TimeoutStartSec=90s, and neither accepts a bare integer. Convert once here, then type the unit letter in the config — that editing step exists either way, so the tool only saves the division.
A column of two hundred runtimes to add upDuration → Value totals exactly the four boxes on screen. There is no list mode, no paste-a-column, no range, so 200 rows means 200 rounds of typing and 200 copied totals.One pass of awk '{s+=$1} END{print s}' over a plain numeric column, or df["s"].sum() in pandas, returns the sum without retyping anything. Take that route once the count passes a handful — this page is for the single figure you paste onward.
The unit is microseconds, nanoseconds, or a frame countThe dropdown holds two entries, seconds and milliseconds, and the four boxes stop at days — no weeks, months or years field. 6,048,000,000 microseconds has to be reduced to 6048 seconds before this page can accept it.Go time.Duration’s .Microseconds(), Python’s datetime.timedelta(microseconds=...), or ffprobe’s duration_ts multiplied by time_base all keep the native unit. When sub-second precision is the point, code is the shorter path.

Units this page can reach, the exact multipliers, and where each one is typed

Unit of timeIn secondsIn millisecondsHow it is entered here
1 millisecond0.0011Dropdown set to milliseconds; it has no field of its own
1 second11000Dropdown set to seconds, the default
1 minute6060000minutes box, multiplied by 60
1 hour36003600000hours box, multiplied by 3600
1 day8640086400000days box, multiplied by 86400
1 week604800604800000No box — type 7 into days
1 month (30 days)25920002592000000No box — type 30 into days
1 year (365 days)3153600031536000000No box — type 365 into days
1 leap year (366 days)3162240031622400000No box — type 366 into days

The four boxes multiply by 86400, 3600, 60 and 1 and add the results; Value → Duration divides by the same constants. No week, month or year constant exists in the code, so a "month" is however many days you decide to type — the 30 above is an engineering convention, not a calendar month, and a 31-day month needs 31. Anything under a second has to be expressed in milliseconds, because the value box drops whatever follows the decimal point: half a second must be typed as 500 with the dropdown on milliseconds, not as 0.5 seconds.

Frequently Asked Questions

Duration versus date difference — what is the distinction?
A date difference answers "how many days from March 1 to March 5" (calendar-aware: unequal months, DST shifts); a duration answers "how many seconds in 2h45m" (pure time quantity). Video lengths, task times, and audio durations belong to the duration tool.
Is an hour always 3600 seconds?
In standard duration math, yes, always. In real calendars, DST transition days can drop or repeat an hour. Use fixed conversion for timing and metrics; bring calendars and timezones in only when scheduling events.
Milliseconds, microseconds, nanoseconds — when does each matter?
Each step is ×1000: 1 s = 10³ ms = 10⁶ µs = 10⁹ ns. Frontend performance lives in milliseconds (100 ms interaction budget), database queries in ms-to-µs, only trading systems and hardware reach nanoseconds. Report metrics in one consistent unit to avoid "0.05 s or 50 ms" confusion.

Content reviewed: