<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCalendar/date(byAdding:value:to:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCalendar(im)dateByAddingUnit:value:toDate:options:"
  },
  "title" : "date(byAdding:value:to:options:)"
}
-->

# date(byAdding:value:to:options:)

Returns a date representing the absolute time calculated by adding the value of a given component to a given date.

```
func date(byAdding unit: NSCalendar.Unit, value: Int, to date: Date, options: NSCalendar.Options = []) -> Date?
```

## Parameters

`unit`

The unit to use for the calculation. For possible values, see [`NSCalendar.Unit`](/documentation/Foundation/NSCalendar/Unit).

`value`

The value for the given unit.

`date`

The date to use to perform the calculation.

`options`

Options for the calculation. See [`NSCalendar.Options`](/documentation/Foundation/NSCalendar/Options) for possible values.

    If you specify a “wrap” option ([`wrapComponents`](/documentation/Foundation/NSCalendar/Options/wrapComponents)    ), the specified components are incremented and wrap around to zero/one on overflow, but do not cause higher units to be incremented. When the wrap option is false, overflow in a unit carries into the higher units, as in typical addition.

## Return Value

A new `NSDate` object representing the absolute time calculated by adding to `date` the `value` of the given calendrical `unit` using the options specified by `options`. Returns `nil` if `date` falls outside the defined range of the receiver or if the computation cannot be performed.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)