parse(_:)

Returns a Date of a given string interpreted using the current settings.

iOS
15.0+
macOS
12.0+
tvOS
15.0+
watchOS
8.0+
func parse(_ value: String) throws -> Date

Parameters

value

A string representation of a date.

Returns

A Date represented by value.

Throws

Throws NSFormattingError if the string cannot be parsed.