---
title: "range(of:start:interval:for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscalendar/range(of:start:interval:for:)"
---

# range(of:start:interval:for:)

Returns by reference the starting time and duration of a given calendar unit that contains a given date.

## Declaration

```swift
func range(of unit: NSCalendar.Unit, start datep: AutoreleasingUnsafeMutablePointer<NSDate?>?, interval tip: UnsafeMutablePointer<TimeInterval>?, for date: Date) -> Bool
```

## Parameters

- `unit`: A calendar unit (see doc://com.apple.foundation/documentation/Foundation/NSCalendar/Unit for possible values).
- `datep`: Upon return, contains the starting time of the calendar unit unit that contains the date date
- `tip`: Upon return, contains the duration of the calendar unit unit that contains the date date
- `date`: A date.

## Return Value

Return Value true if the starting time and duration of a unit could be calculated, otherwise false.

## See Also

### Getting Calendar Information

- [calendarIdentifier](foundation/nscalendar/calendaridentifier.md)
- [firstWeekday](foundation/nscalendar/firstweekday.md)
- [locale](foundation/nscalendar/locale.md)
- [timeZone](foundation/nscalendar/timezone.md)
- [maximumRange(of:)](foundation/nscalendar/maximumrange(of:).md)
- [minimumRange(of:)](foundation/nscalendar/minimumrange(of:).md)
- [minimumDaysInFirstWeek](foundation/nscalendar/minimumdaysinfirstweek.md)
- [ordinality(of:in:for:)](foundation/nscalendar/ordinality(of:in:for:).md)
- [range(of:in:for:)](foundation/nscalendar/range(of:in:for:).md)
- [range(ofWeekendStart:interval:containing:)](foundation/nscalendar/range(ofweekendstart:interval:containing:).md)
- [NSCalendar.Unit](foundation/nscalendar/unit.md)
