string(from:timeZone:formatOptions:)
Creates a representation of the specified date with a given time zone and format options.
Declaration
class func string(from date: Date, timeZone: TimeZone, formatOptions: ISO8601DateFormatter.Options = []) -> StringParameters
- date:
The date to be represented.
- timeZone:
The time zone used.
- formatOptions:
The options used. For possible values, see Options.
Return Value
A user-readable string representing the date.
Discussion
This method uses a date formatter configured with the specified time zone and format options. The following code examples produce the same string value: