Swift Date Format Converter

Swift's `ISO8601DateFormatter` emits strict ISO 8601 strings (`2026-08-13T14:30:00Z`), while `DateFormatter` uses Unicode locale patterns (`yyyy-MM-dd HH:mm:ss`). Getting them wrong is a classic `DateFormatter` "returns nil" bug on iOS.

This converter renders your date-time in the `ISO8601DateFormatter` default form and the equivalent `DateFormatter` pattern so you can debug date parsing in Swift apps.

Timezone:
Enter a date-time above to see the conversion results.

Swift Date Format Converter Quick Reference

FormatPattern / DescriptionExample 1Example 2
Swift / Cocoa Stringyyyy-MM-dd HH:mm:ss Z2026-08-13 14:30:00 +00002026-01-01 00:00:00 +0000

* Examples are rendered in UTC for the fixed sample instants above.

When to Use Swift Date Format

API parsing on iOS

Verify the timestamp shape your backend returns matches `ISO8601DateFormatter` defaults before writing parsing code.

DateFormatter nil debugging

When `DateFormatter.date(from:)` returns nil, compare the input string against the formatter pattern to find the mismatch.

Codable date strategy

Choose the right `JSONDecoder.DateDecodingStrategy` (`.iso8601`, `.formatted`) by matching your API's actual timestamp format.

Frequently Asked Questions

What does ISO8601DateFormatter output?

By default: `2026-08-13T14:30:00Z`. With `.withInternetDateTime` options you get `2026-08-13T14:30:00+00:00`.

Why does my DateFormatter return nil?

The input string does not exactly match the pattern. Common mismatches: missing `Z` for UTC, wrong locale (`en_US_POSIX` needed), or fractional seconds not in the pattern.

What is the difference between ISO8601DateFormatter and DateFormatter?

`ISO8601DateFormatter` is a strict ISO 8601 formatter with fixed options; `DateFormatter` is a flexible, locale-aware formatter using Unicode patterns. Prefer ISO8601DateFormatter for interchange.

What DateFormatter pattern matches ISO 8601?

`yyyy-MM-dd'T'HH:mm:ssXXXXX` with `locale = en_US_POSIX` and `timeZone = UTC` — the standard workaround for pre-iOS 10 parsing.

Related Time Format Converters

All Format Guides

Need to Convert Between All Formats?

Use the main Time Format Converter for instant conversion across 100+ formats — epoch, ISO 8601, RFC 3339, SQL datetime, military time and more in one click.

Open Time Format Converter