string(for:)
Returns a formatted string based on the date information in the specified object.
Declaration
func string(for obj: Any?) -> String?Parameters
- obj:
An object containing the date and time information to format. The object in this parameter must be a Nsdatecomponents object; if it is not, the method raises an exception. This parameter must not be
nil.
Return Value
A formatted string representing the specified date information.
Discussion
This method has the same behavior as the string(from:) method.