Add / Subtract ISO 8601 Durations

Add / Subtract ISO 8601 Durations

Local Processing

Add or subtract an ISO 8601 duration such as P1Y2M3D.

How It Works & Processing Standards

Add or subtract an ISO 8601 duration such as P1Y2M3D.

Tool processing runs in your browser. If you create a calculator or conversion share link, its values are included in the URL. See the privacy policy for account, analytics and advertising data.

Current Limits

  • Maximum input length: 100,000 characters

An ISO 8601 duration writes P followed by Y, M, W, D, and after T the H, M, S parts. Choose add or subtract under "Task"; years and months are applied first on the calendar, then the rest.

Fractional seconds (PT0.5S) are rejected because results are shown to the second.

What You Can Do

Calendar units
Years and months move on the calendar, clamping to month end.
Fixed units
Weeks, days, hours, minutes and seconds move by exact lengths.
Offset kept
A time written with an offset such as +09:00 keeps it in the result.

How to Use Add / Subtract ISO 8601 Durations

  1. 1
    Choose a taskAdd or subtract.
  2. 2
    Enter the base timeAs YYYY-MM-DDTHH:MM:SS.
  3. 3
    Enter the durationSuch as P1M2DT3H.

Examples

Add 1 month 2 days 3 hours
Input: 2026-01-31T10:00:00 + P1M2DT3H
Result: 2026-03-02T13:00:00
Subtract a day
Input: 2026-03-01T00:00:00 − P1D
Result: 2026-02-28T00:00:00

Common Use Cases

  • Seeing when an ISO duration in a config or API (expiry, retention) ends
  • Turning subscription periods such as P1M or P1Y into dates

Frequently Asked Questions (FAQ)

Why is 31 January + P1M2D equal to 2 March?

Adding a month first gives 28 February (there is no 31st), then adding 2 days gives 2 March. Years and months come first, days and time after.

Have feedback or ideas for this tool? Suggest & Inquire →