Contents

string(from:)

Returns a formatted string based on the specified date component information.

Declaration

func string(from components: DateComponents) -> String?

Parameters

  • components:

    A date components object containing the date and time information to format. The Allowedunits property determines which date components are actually used to generate the string. All other date components are ignored. This parameter must not be nil.

Return Value

A formatted string representing the specified date information.

Discussion

Use this method to format date information that is already broken down into the component day and time values.

See Also

Formatting Values