Contents

component(_:from:)

Returns the specified date component from a given date.

Declaration

func component(_ unit: NSCalendar.Unit, from date: Date) -> Int

Parameters

  • unit:

    The component to return. For possible values, see Unit.

  • date:

    The date for which to perform the calculation.

Return Value

An NSInteger value for the requested component.

See Also

Extracting Components