Instance Method

date(from:)

Returns a date representation of a given string interpreted using the receiver’s current settings.

Declaration

func date(from string: String) -> Date?

Parameters

string

The string to parse.

Return Value

A date representation of string interpreted using the receiver’s current settings. If date(from:) can not parse the string, returns nil.

See Also

Converting Objects

func string(from: Date) -> String

Returns a string representation of a given date formatted using the receiver’s current settings.

class func localizedString(from: Date, dateStyle: DateFormatter.Style, timeStyle: DateFormatter.Style) -> String

Returns a string representation of a given date, formatted for the current locale using the specified date and time styles.

func getObjectValue(AutoreleasingUnsafeMutablePointer<AnyObject?>?, for: String, range: UnsafeMutablePointer<NSRange>?)

Returns by reference a date representation of a given string and the range of the string used, and returns a Boolean value that indicates whether the string could be parsed.