dateComponents(_:from:)

Returns all the date components of a date, using the calendar time zone.

iOS
8.0+
macOS
10.10+
tvOS
9.0+
watchOS
2.0+
func dateComponents(_ components: Set<Calendar.Component>, from date: Date) -> DateComponents

Parameters

date

The Date to use.

Returns

The date components of the specified date.