Skip to content

Instance Method

date(from:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Returns a date created from the specified components.
func date(from components: DateComponents) -> Date?

Parameters

components

Used as input to the search algorithm for finding a corresponding date.

Return Value

A new Date, or nil if a date could not be found which matches the components.