---
title: "dateTimeSeparator(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/date/iso8601formatstyle/datetimeseparator(_:)"
---

# dateTimeSeparator(_:)

Sets the character that specifies the date and time components.

## Declaration

```swift
func dateTimeSeparator(_ separator: Date.ISO8601FormatStyle.DateTimeSeparator) -> Date.ISO8601FormatStyle
```

## Parameters

- `separator`: Possible values are space and standard.

## Return Value

Return Value An ISO 8601 date format style with the provided date and time component separator.

## Discussion

Discussion Possible values of Date.ISO8601FormatStyle.DateTimeSeparator are Date.ISO8601FormatStyle.DateTimeSeparator.space and Date.ISO8601FormatStyle.DateTimeSeparator.standard. The following example shows a variety of Date.ISO8601FormatStyle.DateTimeSeparator formats applied to an ISO 8601 date format. let meetingDate = Date() // Jun 23, 2021 at 10:21 AM meetingDate.formatted(.iso8601.dateSeparator(.omitted)) // 20210623 152135Z meetingDate.formatted(.iso8601.dateSeparator(.dash)) // 20210623T152135Z meetingDate.formatted(.iso8601) // 20210623T152135Z If no format is specified as a parameter, the Date.ISO8601FormatStyle.DateTimeSeparator.standard case is the default format. For more information about ISO 8601 formatted dates, see the Date.ISO8601FormatStyle.

## See Also

### 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)
