Contents

dateComponents(in:from:)

Returns all the date components of a date, as if in a given time zone (instead of the Calendar time zone).

Declaration

func dateComponents(in timeZone: TimeZone, from date: Date) -> DateComponents

Parameters

  • timeZone:

    The TimeZone to use.

  • date:

    The Date to use.

Return Value

All components, calculated using the Calendar and TimeZone.

Discussion

The time zone overrides the time zone of the Calendar for the purposes of this calculation.

See Also

Extracting Components