Returns a date representing the absolute time calculated by adding given components to a given date.
- iOS 2.0+
- macOS 10.4+
- tvOS 9.0+
- watchOS 2.0+
The components to add to
The date to which
Options for the calculation. See
NSCalendarfor possible values.
If you specify no options, overflow in a unit carries into the higher units (as in typical addition).
NSDate object representing the absolute time calculated by adding to
date the calendrical components specified by
comps using the options specified by
date falls outside the defined range of the receiver or if the computation cannot be performed.
Some operations can be ambiguous, and the behavior of the computation is calendar-specific, but generally components are added in the order specified.
The following example shows how to add 2 months and 3 days to the current date and time using an existing calendar (
Note that some computations can take a relatively long time.