string(for:)
Creates a formatted string for a date relative to the current date and time.
Declaration
func string(for obj: Any?) -> String?Parameters
- obj:
A date object to format.
Return Value
A string that represents the date interval between a date and the current date and time, or nil if obj isn’t an instance of NSDate.
Discussion
To determine the relative interval, the formatter uses date as the reference date.