ISO 8601 Duration Calculator

Enter an ISO 8601 duration string (e.g. P1Y2M3DT4H5M6S) to parse it into its components — years, months, weeks, days, hours, minutes, and seconds. Or build a duration string by entering individual component values and get the correctly formatted ISO 8601 output. The calculator also shows the total duration in days and total seconds for easy comparison.

Enter a valid ISO 8601 duration string starting with 'P'

yr
mo
wk
day
hr
min
sec

Results

ISO 8601 Duration String

--

Approximate Total Days

--

Approximate Total Seconds

--

Years

--

Months

--

Weeks

--

Days

--

Hours

--

Minutes

--

Seconds

--

Frequently Asked Questions

What is ISO 8601 duration format?

ISO 8601 duration is an international standard for representing time spans. A duration string starts with 'P' (for period), followed by date components (years Y, months M, weeks W, days D), then a 'T' separator, followed by time components (hours H, minutes M, seconds S). For example, P1Y2M3DT4H5M6S means 1 year, 2 months, 3 days, 4 hours, 5 minutes, and 6 seconds.

What does the 'T' separator mean in an ISO 8601 duration?

The 'T' character separates the date portion from the time portion of the duration. Everything before 'T' refers to years, months, weeks, and days. Everything after 'T' refers to hours, minutes, and seconds. The 'T' is only required if time components are present.

Can I omit components I don't need in an ISO 8601 duration?

Yes. You only need to include the components that have non-zero values. For example, P3D means exactly 3 days, and PT2H30M means 2 hours and 30 minutes. The only required character is the leading 'P'. However, you must include at least one component after 'P'.

What is the difference between weeks and days in an ISO 8601 duration?

Weeks (W) and days (D) are both date components but are typically not combined in the same duration string per strict ISO 8601 — weeks represent 7-day periods. In practice, many implementations do support mixing them. P2W3D would mean 2 weeks and 3 days (17 days total).

How are ISO 8601 durations used in XBRL and EDGAR filings?

In XBRL (eXtensible Business Reporting Language) used for EDGAR filings, duration facts like debt instrument terms are expressed in ISO 8601 format. For instance, a 5-year bond term would be represented as P5Y rather than the decimal number 5. This standardizes how time periods are reported in financial documents.

How do I convert a decimal number of years to ISO 8601 duration?

To convert a decimal like 1.5 years, break it into components: 1 year and 0.5 × 12 = 6 months, giving P1Y6M. For more precision, continue breaking fractional months into days using 30.44 days/month. This calculator lets you enter individual components to build the correct ISO 8601 string automatically.

What is the maximum value allowed for each duration component?

ISO 8601 does not strictly cap component values — you can have P100Y or PT3600S. However, well-formed durations typically normalize values (e.g. 60 seconds becomes 1 minute). This calculator accepts any non-negative integer for each component and produces a valid ISO 8601 output.

How is 'total seconds' calculated when months and years are involved?

Because months and years vary in length, an exact total-seconds figure isn't possible without a reference date. This calculator uses standard approximations: 1 year ≈ 365.25 days, 1 month ≈ 30.44 days, and 1 week = 7 days. These give a reasonable estimate suitable for comparison purposes.

More Time & Date Tools