ISO 8601 Duration Converter
Parse an ISO 8601 duration string into total seconds, minutes, hours and days, or assemble one from individual time components.
Mode
Using calendar-year average lengths
- 1
Date part
1 × 31,556,952 + 2 × 2,629,746 + 10 × 86,400 = 37,680,444Years and months use Gregorian calendar averages. - 2
Time part
2 × 3,600 + 30 × 60 = 9,000 - 3
Total seconds
37,680,444 + 9,000 = 37,689,444
How does this calculator work?
An ISO 8601 duration like P1Y2M10DT2H30M is converted to total seconds by weighting each part with average lengths: years at 31,556,952 s, months at 2,629,746 s, weeks 604,800 s, days 86,400 s, plus literal hours, minutes and seconds. Minutes, hours and days follow by division.
Formula
How this is calculated
In Parse mode, the calculator matches your string against the ISO 8601 duration grammar P(n)Y(n)M(n)W(n)D T(n)H(n)M(n)S. Each component (years, months, weeks, days, hours, minutes, seconds) is optional, and the T separator divides date parts from time parts. The seconds value may be fractional; all others are whole numbers. In Build mode you enter each component directly and the tool assembles the normalized PnYnMnDTnHnMnS string for you.
Total seconds are computed by weighting each component: one year is treated as the calendar-year average of 31,556,952 seconds (365.2425 days), one month as one twelfth of that (2,629,746 seconds), one week as 604,800 seconds, one day as 86,400 seconds, plus the literal hour, minute and second amounts. The other totals are simple divisions of the seconds figure (÷60, ÷3600, ÷86400).
Because calendar months and years vary in length, the year and month averages are approximations rather than exact spans tied to a specific start date. For exact wall-clock arithmetic anchor the duration to a real start instant. Weeks are folded into days in the normalized output, so P1W becomes P7D. Invalid strings (those not matching the grammar, or a bare "P") return no result.
Frequently asked questions
A year uses the Gregorian calendar average of 365.2425 days (31,556,952 seconds) and a month is one twelfth of that (2,629,746 seconds). These averages keep conversions consistent without needing a start date.
Yes. In Parse mode a W component such as P2W is accepted and counted as 7 days each. In the normalized output weeks are converted into days, so the W field is folded into D.
This converter uses average month and year lengths. Adding a duration to a specific calendar date accounts for the actual number of days in those months and years, including leap days, so results can differ slightly.
Also known as
TG we-Calculate Editorial Team. (2026). ISO 8601 Duration Converter [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/iso-8601-duration-converter
TG we-Calculate Editorial Team. "ISO 8601 Duration Converter." TG we-Calculate. 2026. https://we-calculate.com/calculator/iso-8601-duration-converter.
TG we-Calculate Editorial Team, "ISO 8601 Duration Converter," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/iso-8601-duration-converter
@misc{wecalculate_iso_8601_duration_converter, title = {ISO 8601 Duration Converter}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/iso-8601-duration-converter}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
