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

# range(of:in:for:)

Returns the range of absolute time values that a smaller calendar unit (such as a day) can take on in a larger calendar unit (such as a month) that includes a specified absolute time.

## Declaration

```swift
func range(of smaller: NSCalendar.Unit, in larger: NSCalendar.Unit, for date: Date) -> NSRange
```

## Parameters

- `smaller`: The smaller calendar unit.
- `larger`: The larger calendar unit.
- `date`: The absolute time for which the calculation is performed.

## Return Value

Return Value The range of absolute time values smaller can take on in larger at the time specified by date. Returns {NSNotFound, NSNotFound} if larger is not logically bigger than smaller in the calendar, or the given combination of units does not make sense (or is a computation which is undefined).

## Discussion

Discussion You can use this method to calculate, for example, the range the Day unit can take on in the Month in which date lies.

## 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:start:interval:for:)](foundation/nscalendar/range(of:start:interval:for:).md)
- [range(ofWeekendStart:interval:containing:)](foundation/nscalendar/range(ofweekendstart:interval:containing:).md)
- [NSCalendar.Unit](foundation/nscalendar/unit.md)
