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) -> DateComponentsParameters
- timeZone:
The
TimeZoneto use. - date:
The
Dateto 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.