Xerobit

ISO 8601 Converter for Dates and Durations

Enter an ISO 8601 datetime string or a duration like P1Y2M3DT4H5M6S to convert it to RFC 2822, Unix timestamp, human-readable text, or total seconds. This iso 8601 converter runs entirely in your browser with no data uploaded, making it safe for sensitive log parsing and API debugging.

Result

  • Unix timestamp
    1710513000
  • RFC 2822
    Fri, 15 Mar 2024 14:30:00 +0000
  • As entered
    2024-03-15 14:30:00 UTC
  • Week date
    2024-W11-5
  • Ordinal date
    2024-075

How to use the iso 8601 converter

  1. Paste an ISO 8601 datetime string (like 2024-03-15T14:30:00Z) or a duration (like P1DT12H) into the input field.
  2. The tool automatically detects whether you entered a date, a week date, an ordinal date, or a duration.
  3. Review the output rows for the Unix timestamp, RFC 2822 format, the time as entered, or total seconds.
  4. For durations, see both the total seconds and the broken-down components.

How the ISO 8601 Date Conversion Works

The standard defines several ways to represent a point in time. The most common is the extended calendar format: YYYY-MM-DDTHH:mm:ss.sssZ. When you use this iso 8601 converter, the parser extracts each component and computes the Unix epoch by counting seconds since 1970-01-01T00:00:00Z.

For example, 2024-03-15T14:30:00Z breaks down as year 2024, month 3, day 15, hour 14, minute 30, second 0. The algorithm counts the days from the epoch to that calendar date, multiplies by 86400 and adds the time-of-day seconds. The result is 1710513000.

If a timezone offset is present, such as -05:00, the parser adds that offset to normalize the time to UTC before computing the timestamp. This ensures consistent results regardless of where the original time was recorded.

Parsing ISO 8601 Durations

An ISO 8601 duration looks like PnYnMnDTnHnMnS. The letter P starts the expression, T separates the date portion from the time portion, and each number is followed by its unit designator. A week duration is written alone, such as P2W for 14 days. As an iso 8601 duration converter, this tool parses every component and sums them into total seconds.

To do this reliably, years are treated as 365.2425 days (the Gregorian average) and months as 30.436875 days. For example, P1Y2M3DT4H5M6S becomes:

  • 1 year = 31556952 seconds
  • 2 months = 5259492 seconds
  • 3 days = 259200 seconds
  • 4 hours = 14400 seconds
  • 5 minutes = 300 seconds
  • 6 seconds = 6 seconds

Total: 37090350 seconds. If you need exact calendar arithmetic that accounts for specific month lengths, pair this with a dedicated date calculator or hours calculator.

Week Dates and Ordinal Dates

Beyond the familiar calendar format, ISO 8601 supports week dates (YYYY-Www-D) and ordinal dates (YYYY-DDD). A week date identifies a day by its ISO week number and weekday. Week 1 is the week containing the first Thursday of the year, and Monday is day 1.

For instance, 2024-W11-5 means the Friday of the 11th ISO week of 2024. The converter translates this to the calendar date 2024-03-15 by finding January 4th (always in week 1), locating the Monday of that week, then adding the appropriate weeks and days.

An ordinal date like 2024-075 simply means the 75th day of 2024. Since 2024 is a leap year, day 75 falls on March 15th. These formats appear frequently in logistics, scientific datasets, and broadcast scheduling.

Common Format Reference

Here is a quick reference showing how a single moment appears across different representations. All values below correspond to 2024-03-15T14:30:00Z:

FormatExample
ISO 8601 (UTC)2024-03-15T14:30:00Z
ISO 8601 (offset)2024-03-15T09:30:00-05:00
RFC 2822Fri, 15 Mar 2024 14:30:00 +0000
Unix timestamp1710513000
Week date2024-W11-5
Ordinal date2024-075

When working with APIs, you will often need to switch between these. JSON payloads typically use ISO 8601, email headers use RFC 2822 dates, and HTTP headers use the IMF-fixdate format from RFC 9110, which is a fixed-width form of the same style. Databases may store Unix timestamps internally. This iso 8601 date converter handles all these translations instantly.

Edge Cases and Common Mistakes

A few pitfalls trip up developers when handling ISO 8601 strings:

  • Missing timezone: A string like 2024-03-15T14:30:00 without a Z or offset is technically ambiguous. This tool treats it as UTC and says so next to the Unix timestamp, while many parsers assume local time, so always include a Z or offset.
  • Mixing basic and extended formats: Basic format drops hyphens and colons (20240315T143000Z). Extended uses them. Do not mix the two within one string.
  • Leap seconds: ISO 8601 allows 23:59:60 for leap seconds, but most programming environments cannot represent them natively.
  • Duration months and years: Because months vary from 28 to 31 days, converting P1M to seconds requires an assumption. This tool uses the Gregorian average (365.2425 days per year, 30.436875 per month). Python's isodate library keeps years and months separate instead and needs a start date to turn them into seconds, so for exact calendar results use a date calculator.

If you are converting raw milliseconds rather than full timestamps, you might also find the ms to seconds tool useful alongside this one.

Worked examples

ExampleInputResult
UTC datetimeISO 8601 value: 2024-03-15T14:30:00ZUnix timestamp: 1710513000; RFC 2822: Fri, 15 Mar 2024 14:30:00 +0000; As entered: 2024-03-15 14:30:00 UTC; Week date: 2024-W11-5; Ordinal date: 2024-075
Datetime with offsetISO 8601 value: 2024-07-04T09:00:00-05:00Unix timestamp: 1720101600; RFC 2822: Thu, 04 Jul 2024 09:00:00 -0500; As entered: 2024-07-04 09:00:00 -05:00; Week date: 2024-W27-4; Ordinal date: 2024-186
DurationISO 8601 value: P1Y2M3DT4H5M6STotal seconds: 37090350; Human readable: 1 year, 2 months, 3 days, 4 hours, 5 minutes, 6 seconds; ISO 8601: P1Y2M3DT4H5M6S
Week dateISO 8601 value: 2024-W11-5Unix timestamp: 1710460800; RFC 2822: Fri, 15 Mar 2024 00:00:00 +0000; As entered: 2024-03-15 00:00:00 UTC; Calendar date: 2024-03-15; Week date: 2024-W11-5
Ordinal dateISO 8601 value: 2024-075Unix timestamp: 1710460800; RFC 2822: Fri, 15 Mar 2024 00:00:00 +0000; As entered: 2024-03-15 00:00:00 UTC; Calendar date: 2024-03-15; Ordinal date: 2024-075

FAQ

What is an ISO 8601 converter used for?

It translates ISO 8601 formatted strings into other representations like Unix timestamps, RFC 2822, or plain English. Developers use it when debugging APIs, parsing logs, or converting between systems that expect different date formats.

How do I read an ISO 8601 duration like P1DT12H?

The P marks the start, D stands for days, T separates date units from time units, and H stands for hours. So P1DT12H means one day and twelve hours, which equals 129600 seconds.

Does this tool handle timezone offsets?

Yes. You can enter datetimes with any valid offset such as +05:30 or -08:00. The converter normalizes everything to UTC for the Unix timestamp and displays the offset in the RFC 2822 output.

What is the difference between a week date and an ordinal date?

A week date (like 2024-W11-5) specifies a year, ISO week number, and day of week. An ordinal date (like 2024-075) specifies a year and the day number within that year, from 1 to 365 or 366.

Is my data sent to a server?

No. This iso 8601 converter processes everything locally in your browser. Nothing is uploaded or stored, so it is safe to use with production log data or sensitive timestamps.

Why does converting months in a duration use fractional days?

Months have varying lengths. To produce a deterministic number of seconds, the converter uses the Gregorian average of 30.436875 days per month and 365.2425 days per year. Days, hours, minutes, seconds and weeks are exact.