ISO 8601 duration builder
Build a portable ISO 8601 duration such as P1Y2M3DT4H or P2W, with the week-mixing rule.
Loading tool…
Recommended next step
Related date tools
After using ISO 8601 duration builder, continue with Duration between times.
Continue this path
Tools selected to complete the same task.
Tool guide
ISO 8601 duration builder: how it works
Practical information to understand the result and use this tool correctly.
About ISO 8601 duration builder
An ISO 8601 duration looks like P1Y2M3DT4H30M. The date part sits after P; the time part sits after T.
Weeks use PnW and must not be combined with years, months, or days. Two weeks is P2W, not P2WT0S.
Zero components are omitted. All zeros become P0D. A negative component is rejected instead of emitting -P.
How to use it
- 1Enter whole years, months, weeks, days, hours, minutes, and seconds. Blank counts as 0 if another field has a value.
- 2Load a preset for a 90-minute meeting, a 2-week sprint, or a 1Y2M3DT4H lease.
- 3Read the ISO string and the approximate second count (365.2425 days/year, 30.436875 days/month).
- 4Copy the duration or reset. Nothing is uploaded.
Frequently asked questions
- What is 1 year, 2 months, 3 days, and 4 hours?
- P1Y2M3DT4H. Zero minutes and seconds are omitted. The approximate second count uses 1×365.2425×86400 + 2×30.436875×86400 + 3×86400 + 4×3600.
- What is 2 weeks, or 1 hour and 30 minutes?
- Two weeks is P2W (14×86400 = 1,209,600 s). One hour and 30 minutes is PT1H30M (5400 s), with no date part before T.
- Why can't weeks mix with days?
- ISO 8601-1 puts the week designator in the date part and does not combine it with Y, M, or D. P2W14D is invalid here; use P2W or P14D.
- What happens with empty, zero, negative, or NaN?
- All blank fields are an error. All zeros become P0D. A minus sign, text, or a fraction is rejected. Each component must be an integer from 0 to 9999.