Returns the difference between start and end dates given as date components.
- iOS 8.0+
- macOS 10.9+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
Specifies the components for the returned
The start date for the calculation as an
The end date for the calculation as an
optionsparameter is currently unused.
NSDate object whose components are specified by
unit and calculated from the difference between the
result using the options specified by
nil if either date falls outside the defined range of the receiver or if the computation cannot be performed.
NSDate object does not specify a value for a calendar unit required to determine an absolute date, the base value of that unit is assumed. For example, given an
NSDate object with only a
year and a
month specified, the resulting
NSDate object would be constructed using a
day value of
nanosecond values of
0. Passing an
NSDate argument with an unspecified
year value is not advised.
time property is set, the time zone property value will be used in the calculation. If an
calendar property is set, the calendar property value will be used instead of the receiving calendar. If both an
calendar properties are set, the time zone property value overrides the time zone of the calendar property value.