Home › Time & Date › ISO 8601 Duration Converter

ISO 8601 Duration Converter

Paste an ISO 8601 duration such as PT1H30M or P3Y6M4DT12H30M5S to see it in plain words, total seconds, h:mm:ss and days, or go the other way and build a valid duration string from numbers or a number of seconds.

Last updated:

What do you want to do?

Examples: PT45M, P1DT2H30M, P3Y6M4DT12H30M5S, PT0.5S, P2W, P0003-06-04T12:30:05

Enter seconds (95400, 3600.5) or a clock duration (26:30:00, 1:02:03:04 for d:h:m:s).

Years and months have no fixed length. Pick a start date for an exact answer.

Enter your values to see the result.
Advertisement
Advertisement

How to use the ISO 8601 Duration Converter

  1. Choose a mode: parse an ISO string, build one from parts, or convert seconds and h:m:s.
  2. Enter the duration, for example PT1H30M, or fill in the number fields.
  3. Pick how years and months count: average lengths, 365/30 days, or exactly from a start date.
  4. Read the results: words, total seconds, h:mm:ss, normalised and seconds-only ISO forms.
  5. Copy the results or download the component breakdown as CSV.

The ISO 8601 duration format

An ISO 8601 duration describes a length of time, not a moment. Its general form is PnYnMnWnDTnHnMnS: the letter P (period) starts the string, date units follow, then T introduces the time units. Any unit that is zero can be left out, but at least one must remain, and units always appear in this order.

DesignatorMeaningExampleEquals
PStart of the duration (required)P1D1 day
YYearsP2Y2 years
M (before T)MonthsP6M6 months
WWeeksP2W14 days
DDaysP10D10 days
TStart of the time part (required before H, M, S)PT45M45 minutes
HHoursPT8H8 hours
M (after T)MinutesPT90M1 hour 30 minutes
SSeconds, decimals allowedPT0.5S500 milliseconds

An alternative format writes the same values in date-and-time style with fixed widths: P0003-06-04T12:30:05 means 3 years, 6 months, 4 days, 12 hours, 30 minutes and 5 seconds.

Converting to seconds

For the time part the arithmetic is exact: seconds = H × 3,600 + M × 60 + S, plus 86,400 per day and 604,800 per week. For example, P1DT2H30M = 86,400 + 7,200 + 1,800 = 95,400 seconds, which is 26:30:00 as hours, minutes and seconds.

Years and months are calendar units, so their length depends on when they start. Adding P1M to January 31 gives February 28 or 29, while adding it to March 1 gives April 1. Most libraries clamp to the last valid day of the month, which is what the exact mode here does. When no date is involved, the average Gregorian year (365.2425 days) is the most neutral choice.

Common durations

DurationISO 8601Seconds
30 secondsPT30S30
15 minutesPT15M900
1 hour 30 minutesPT1H30M5,400
1 dayP1D (or PT24H)86,400
1 weekP1W (or P7D)604,800
30 daysP30D2,592,000
1 year (365 days)P365D31,536,000
  • Prefer days and time units for exact lengths. Write P30D rather than P1M when you mean exactly thirty days, for instance for a token lifetime or a retention period.
  • PT0S is the zero duration. A bare P or PT is invalid.
  • Watch out for weeks. Older parsers reject P1W2D; P9D is safest.

Frequently asked questions

What does PT1H30M mean?

It is an ISO 8601 duration of 1 hour and 30 minutes. P marks a period, T separates the date part from the time part, and each number is followed by its unit: H for hours, M for minutes and S for seconds. It equals 5,400 seconds.

Why is M used for both months and minutes?

Position decides. An M before the T means months (P2M is two months), and an M after the T means minutes (PT2M is two minutes). P2MT2M is two months and two minutes.

How many seconds is P1D?

86,400 seconds in normal time arithmetic. On a calendar, one day can be 23 or 25 hours across a daylight-saving change, which is why some libraries keep days separate from hours.

How many seconds are in a month or a year in ISO 8601?

ISO 8601 does not fix them, because months have 28 to 31 days and years 365 or 366. This converter uses the average Gregorian year of 365.2425 days (month = 30.436875 days) by default, or 365 and 30 days, or counts exactly from a start date you choose.

Can an ISO 8601 duration be negative?

Not in the core ISO 8601-1 standard. A leading minus sign, as in -P1D or -PT30M, is an extension used by XML Schema, Java and several other systems, and this tool accepts it with a note.

Can I use decimals, like PT1.5H?

Yes, ISO 8601 allows a decimal fraction (with a dot or comma) on the smallest unit, so PT1.5H, PT0.25S and P0.5D are valid. Putting a fraction on a larger unit followed by more units, like PT1.5H30M, is not allowed.

Where are ISO 8601 durations used?

In video and API metadata (for example video lengths such as PT4M13S), schema.org fields like cookTime and duration, XML Schema xs:duration, calendar recurrence rules, Java and .NET time libraries, and configuration files for timeouts and retention periods.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Time Duration CalculatorHours, minutes and seconds between two times, overnight too.Unix Timestamp ConverterConvert epoch timestamps to dates and back.Date CalculatorAdd days to a date or count days between dates.Today's DateWhat is today's date? Live date in every format: ISO, US/EU, week number, Unix, Hijri, Hebrew.Days Between DatesCount days, weeks, months and business days between two dates.Business Days CalculatorCount working days between dates, excluding weekends and holidays.Day of the Week CalculatorFind the weekday of any date, with Zeller and Doomsday steps.Half Birthday CalculatorFind your half birthday date, the countdown to it and your age in halves.Retirement Date CalculatorFind the exact date you reach retirement age, with a live countdown.Age Difference CalculatorFind the exact age gap between two people in years, months and days.Day of the Year CalculatorFind the day number of any date (1–366), days left, ISO week and quarter, or turn a day number into a date.Anniversary CalculatorHow long you've been together, your next anniversary and traditional and modern gifts by year.Time Since CalculatorLive counter of the time since any date: years, months, days, hours, minutes and seconds.Excel Date ConverterConvert Excel serial numbers to dates and times and back, in the 1900 or 1904 date system.Baby Age CalculatorYour baby's exact age in days, weeks and months, plus the next monthly milestone date.Corrected Age CalculatorChronological and corrected (adjusted) age for preemies from the due date or weeks at birth.Date to Roman NumeralsConvert a date into Roman numerals (MM.DD.YYYY or DD.MM.YYYY) for tattoos and engravings.Dog Heat Cycle CalculatorPredict your dog's next heat dates and fertile window from the last heat and cycle length.Egg Incubation CalculatorCandling, lockdown and hatch dates for chicken, duck, quail, goose and turkey eggs.Expiration Date CalculatorGet the expiry date and days left from a manufacture or opening date plus shelf life.Fiscal Year CalculatorFind the fiscal year, quarter, period and week for any date and any fiscal year start.What Generation Am I CalculatorFind your generation from your birth year: Boomer, Gen X, Millennial, Gen Z or Gen Alpha.Harvest Date CalculatorExpected harvest date and window from planting date and days to maturity, with succession.Hebrew Date ConverterConvert Gregorian dates to Hebrew calendar dates and back, with after-sunset option.Nepali Date ConverterConvert AD dates to Bikram Sambat (BS) and back, with Nepali month names and numerals.Notice Period CalculatorFind when a notice period ends: last working day and days remaining from any notice date.Oil Change Due CalculatorFind your next oil change date and odometer reading from your last change and driving.Persian (Jalali) Date ConverterConvert Gregorian dates to the Persian Jalali (Shamsi) calendar and back, with month names.Seed Starting Date CalculatorWhen to start seeds indoors, transplant and direct sow each crop from your last frost date.30 Days From TodayFind the date 30 days from today or any start date, with weekday and business days.60 Days From TodayFind the date 60 days from today or any start date, with weekday, business days and a calendar.90 Days From TodayFind the date 90 days from today or any date, with weekday, business days and a calendar.Animal Gestation CalculatorDue date, birth window and milestones for goats, sheep, pigs, cows, horses, rabbits and more.Horse Foaling Date CalculatorMare due date, foaling window and pregnancy care calendar from the cover date.Full Retirement Age CalculatorYour Social Security full retirement age, earliest claim date, 62 reduction and Medicare date.Maternity Leave CalculatorPlan maternity leave: start date, paid, PTO and unpaid weeks, and your return-to-work date.Medicare Enrollment Period CalculatorFind your Medicare Initial Enrollment Period, coverage start dates and sign-up deadlines.Sobriety CalculatorCount days, weeks, months and years sober from your sober date, with milestones and money saved.Age Milestones CalculatorSee when you turn 10,000 days, 1,000 weeks, 500 months or 1 billion seconds old.Baby Leaps CalculatorFind your baby's 10 developmental leap weeks and fussy-period dates from the due date.Birthday Moon PhaseSee the moon phase on the night you were born and which future birthdays fall on a full moon.Chronological Age CalculatorExact age in years, months and days on a test date, using the borrow method for assessments.Day Length CalculatorHours of daylight for any place and date, change vs yesterday and a year chart by latitude.Easter Date CalculatorWestern and Orthodox Easter for any year, with Ash Wednesday, Good Friday and Pentecost.Famous Birthdays by DatePick any date to see famous people born that day, sorted by year, with ages and categories.Length of Service CalculatorYears, months and days of service from hire and end dates, plus your next work anniversary.Months Between DatesExact calendar months and days between two dates, decimal months and a month-by-month list.Who Was President When I Was BornEnter your birth date to see the US president and VP that day, plus every president in your lifetime.Project End Date CalculatorTurn effort hours, team size and workdays into a completion date with a work-day calendar.Weekday CounterCount how many Mondays, Fridays or any weekdays fall between two dates and list them.Working Days Per Month CalculatorWorking days and hours for every month of a year, minus weekends and US federal holidays.What Year Was I Born CalculatorFind your birth year from your age, or from your age on any date, plus an age-by-year table.100 Days From TodayFind the date 100 days from today or any date, with weekday, business days and a calendar.180 Days From TodayFind the date 180 days from today or any date, with weekday, business days and a calendar.6 Months From TodayFind the date 6 months from today or any date, its weekday, day count and business days.Breast Milk Storage CalculatorUse-by date and time for pumped breast milk at room temp, in the fridge or freezer (CDC).Half Marathon Training Plan Generator10 to 16 week half marathon plan from your race date and level, with long runs, taper, paces and .ics.Horse Age CalculatorConvert horse years to human years, see the life stage, or get exact age from a foaling date.Moving Checklist GeneratorEnter your move date and situation for a week-by-week moving to-do list with real dates.Home Inventory ListRoom-by-room home inventory with values, purchase dates, serial numbers and photos; print or CSV.Wedding Invitation Timeline CalculatorWhen to send save-the-dates and invitations, plus your RSVP deadline and final headcount date.Tax Refund Date EstimatorEstimate when your IRS refund arrives by filing date, e-file or paper, deposit or check.PTO Holiday OptimizerFind the bridge days around US holidays that turn your PTO into the most days off in a row.
See all 62 Date Calculators →