Instance Method

isEqual(to:)

Returns a Boolean value that indicates whether a given object is a date that is exactly equal the receiver.

Declaration

func isEqual(to otherDate: Date) -> Bool

Parameters

anotherDate

The date to compare with the receiver.

Return Value

true if the anotherDate is an NSDate object and is exactly equal to the receiver, otherwise false.

Discussion

This method detects sub-second differences between dates. If you want to compare dates with a less fine granularity, use timeIntervalSince(_:) to compare the two dates.

See Also

Comparing Dates

func earlierDate(Date) -> Date

Returns the earlier of the receiver and another given date.

func laterDate(Date) -> Date

Returns the later of the receiver and another given date.

func compare(Date) -> ComparisonResult

Indicates the temporal ordering of the receiver and another given date.