<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Date/ISO8601FormatStyle/timeSeparator(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV18ISO8601FormatStyleV13timeSeparatoryA2E04TimeG0OF"
  },
  "title" : "timeSeparator(_:)"
}
-->

# timeSeparator(_:)

Modifies the ISO 8601 date format style to use the specified time separator.

```
func timeSeparator(_ separator: Date.ISO8601FormatStyle.TimeSeparator) -> Date.ISO8601FormatStyle
```

## Parameters

`separator`

Character used to separate the hour and minute in a date.

## Return Value

An ISO 8601 date format style modified to include the specified time separator style.

## Discussion

Possible values of [`Date.ISO8601FormatStyle.TimeSeparator`](/documentation/Foundation/Date/ISO8601FormatStyle/TimeSeparator-swift.enum) are [`Date.ISO8601FormatStyle.TimeSeparator.colon`](/documentation/Foundation/Date/ISO8601FormatStyle/TimeSeparator-swift.enum/colon) and [`Date.ISO8601FormatStyle.TimeSeparator.omitted`](/documentation/Foundation/Date/ISO8601FormatStyle/TimeSeparator-swift.enum/omitted).

This example shows a variety of ISO 8601 time separator formats applied to an ISO 8601 date format:

```swift
let meetingDate = Date() // Jun 23, 2021 at 1:41 PM
meetingDate.formatted(.iso8601.timeSeparator(.omitted)) // 20210623T184148Z
meetingDate.formatted(.iso8601.timeSeparator(.colon)) // 20210623T18:41:48Z
meetingDate.formatted(.iso8601) // 20210623T184148Z
```

If no format is specified as a parameter, the [`Date.ISO8601FormatStyle.DateSeparator.omitted`](/documentation/Foundation/Date/ISO8601FormatStyle/DateSeparator-swift.enum/omitted) case is the default format.

For more information about ISO 8601 formatted dates, see the [`Date.ISO8601FormatStyle`](/documentation/Foundation/Date/ISO8601FormatStyle).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)