Contents

compare(_:)

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

Declaration

func compare(_ other: Date) -> ComparisonResult

Parameters

  • other:

    The date with which to compare the receiver.

    This value must not be nil. If the value is nil, the behavior is undefined and may change in future versions of macOS.

Return Value

If:

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

Related Documentation

Comparing Dates