Skip to content

Instance MethodFoundationEssentials

ISO8601Format(_:)

iOS 15.0+ iPadOS 15.0+ Mac Catalyst 15.0+ macOS 12.0+ tvOS 15.0+ watchOS 8.0+
Generates a locale-aware string representation of a date using the ISO 8601 date format.
func ISO8601Format(_ style: Date.ISO8601FormatStyle = .init()) -> String

Parameters

style

A customized Date.ISO8601FormatStyle to apply. By default, the method applies an unmodified ISO 8601 format style.

Return Value

A string, formatted according to the specified style.

Discussion

Calling this method is equivalent to passing a Date.ISO8601FormatStyle to a date’s formatted() method.