---
title: "date(byAdding:value:to:options:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscalendar/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.

## Declaration

```swift
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 doc://com.apple.foundation/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 doc://com.apple.foundation/documentation/Foundation/NSCalendar/Options for possible values. If you specify a “wrap” option (doc://com.apple.foundation/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

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.

## See Also

### Calculating Dates

- [date(from:)](foundation/nscalendar/date(from:).md)
- [date(byAdding:to:options:)](foundation/nscalendar/date(byadding:to:options:).md)
- [date(bySettingHour:minute:second:of:options:)](foundation/nscalendar/date(bysettinghour:minute:second:of:options:).md)
- [date(bySettingUnit:value:of:options:)](foundation/nscalendar/date(bysettingunit:value:of:options:).md)
- [date(era:year:month:day:hour:minute:second:nanosecond:)](foundation/nscalendar/date(era:year:month:day:hour:minute:second:nanosecond:).md)
- [date(era:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:)](foundation/nscalendar/date(era:yearforweekofyear:weekofyear:weekday:hour:minute:second:nanosecond:).md)
- [nextWeekendStart(_:interval:options:after:)](foundation/nscalendar/nextweekendstart(_:interval:options:after:).md)
