---
title: Date.ISO8601FormatStyle
framework: foundation
role: symbol
role_heading: Structure
path: foundation/date/iso8601formatstyle
---

# Date.ISO8601FormatStyle

A type that converts between dates and their ISO-8601 string representations.

## Declaration

```swift
struct ISO8601FormatStyle
```

## Overview

Overview The Date.ISO8601FormatStyle type generates and parses string representations of dates following the ISO-8601 standard, like 2024-04-01T12:34:56.789Z. Use this type to create ISO-8601 representations of dates and create dates from text strings in ISO 8601 format. For other formatting conventions, like human-readable, localized date formats, use Date.FormatStyle. Instance modifier methods applied to an ISO-8601 format style customize the formatted output, as the following example illustrates. let now = Date() print(now.formatted(Date.ISO8601FormatStyle().dateSeparator(.dash))) // 2021-06-21T211015Z Use the static factory property FormatStyle/iso8601 to create an instance of Date.ISO8601FormatStyle. Then apply instance modifier methods to customize the format, as in the example below. let meetNow = Date() let formatted = meetNow.formatted(.iso8601     .year()     .month()     .day()     .timeZone(separator: .omitted)     .time(includingFractionalSeconds: true)     .timeSeparator(.colon) ) // "2022-06-10T12:34:56.789Z"

## Topics

### Creating an ISO 8601 Format Style

- [init(dateSeparator:dateTimeSeparator:timeZone:)](foundation/date/iso8601formatstyle/init(dateseparator:datetimeseparator:timezone:).md)

### Modifying an ISO 8601 Format Style

- [dateSeparator](foundation/date/iso8601formatstyle/dateseparator-swift.property.md)
- [dateTimeSeparator](foundation/date/iso8601formatstyle/datetimeseparator-swift.property.md)
- [timeZone](foundation/date/iso8601formatstyle/timezone.md)
- [dateTimeSeparator(_:)](foundation/date/iso8601formatstyle/datetimeseparator(_:).md)

### Modifying Dates in an ISO 8601 Format Style

- [dateSeparator(_:)](foundation/date/iso8601formatstyle/dateseparator(_:).md)
- [year()](foundation/date/iso8601formatstyle/year().md)
- [month()](foundation/date/iso8601formatstyle/month().md)
- [weekOfYear()](foundation/date/iso8601formatstyle/weekofyear().md)
- [day()](foundation/date/iso8601formatstyle/day().md)

### Modifying Times in an ISO 8601 Format Style

- [time(includingFractionalSeconds:)](foundation/date/iso8601formatstyle/time(includingfractionalseconds:).md)
- [timeSeparator(_:)](foundation/date/iso8601formatstyle/timeseparator(_:).md)
- [timeZone(separator:)](foundation/date/iso8601formatstyle/timezone(separator:).md)
- [timeZoneSeparator(_:)](foundation/date/iso8601formatstyle/timezoneseparator(_:).md)

### Parsing an ISO 8601 Format Style

- [parse(_:)](foundation/date/iso8601formatstyle/parse(_:).md)
- [parseStrategy](foundation/date/iso8601formatstyle/parsestrategy.md)

### Applying an ISO 8601 Format Style

- [format(_:)](foundation/date/iso8601formatstyle/format(_:).md)

### Comparing ISO 8601 Format Styles

- [==(_:_:)](foundation/date/==(_:_:).md)

### Supporting Types

- [Date.ISO8601FormatStyle.DateSeparator](foundation/date/iso8601formatstyle/dateseparator-swift.enum.md)
- [Date.ISO8601FormatStyle.DateTimeSeparator](foundation/date/iso8601formatstyle/datetimeseparator-swift.enum.md)
- [Date.ISO8601FormatStyle.TimeSeparator](foundation/date/iso8601formatstyle/timeseparator-swift.enum.md)
- [Date.ISO8601FormatStyle.TimeZoneSeparator](foundation/date/iso8601formatstyle/timezoneseparator-swift.enum.md)

### Initializers

- [init(dateSeparator:dateTimeSeparator:timeSeparator:timeZoneSeparator:includingFractionalSeconds:timeZone:)](foundation/date/iso8601formatstyle/init(dateseparator:datetimeseparator:timeseparator:timezoneseparator:includingfractionalseconds:timezone:).md)

### Instance Properties

- [includingFractionalSeconds](foundation/date/iso8601formatstyle/includingfractionalseconds.md)
- [timeSeparator](foundation/date/iso8601formatstyle/timeseparator-swift.property.md)
- [timeZoneSeparator](foundation/date/iso8601formatstyle/timezoneseparator-swift.property.md)

### Default Implementations

- [CustomConsumingRegexComponent Implementations](foundation/date/iso8601formatstyle/customconsumingregexcomponent-implementations.md)
- [FormatStyle Implementations](foundation/date/iso8601formatstyle/formatstyle-implementations.md)
- [ParseStrategy Implementations](foundation/date/iso8601formatstyle/parsestrategy-implementations.md)
- [ParseableFormatStyle Implementations](foundation/date/iso8601formatstyle/parseableformatstyle-implementations.md)
- [RegexComponent Implementations](foundation/date/iso8601formatstyle/regexcomponent-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomConsumingRegexComponent](swift/customconsumingregexcomponent.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [FormatStyle](foundation/formatstyle.md)
- [Hashable](swift/hashable.md)
- [ParseStrategy](foundation/parsestrategy.md)
- [ParseableFormatStyle](foundation/parseableformatstyle.md)
- [RegexComponent](swift/regexcomponent.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Applying date and time styles

- [dateTime](foundation/formatstyle/datetime.md)
- [Date.FormatStyle](foundation/date/formatstyle.md)
- [verbatim(_:locale:timeZone:calendar:)](foundation/formatstyle/verbatim(_:locale:timezone:calendar:).md)
- [Date.VerbatimFormatStyle](foundation/date/verbatimformatstyle.md)
- [interval](foundation/formatstyle/interval.md)
- [Date.IntervalFormatStyle](foundation/date/intervalformatstyle.md)
- [relative(presentation:unitsStyle:)](foundation/formatstyle/relative(presentation:unitsstyle:).md)
- [Date.RelativeFormatStyle](foundation/date/relativeformatstyle.md)
- [components(style:fields:)](foundation/formatstyle/components(style:fields:).md)
- [Date.ComponentsFormatStyle](foundation/date/componentsformatstyle.md)
