---
title: "CFCalendarGetRangeOfUnit(_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfcalendargetrangeofunit(_:_:_:_:)"
---

# CFCalendarGetRangeOfUnit(_:_:_:_:)

Returns the range of values that one unit can take on within a larger unit during which a specific absolute time occurs.

## Declaration

```swift
func CFCalendarGetRangeOfUnit(_ calendar: CFCalendar!, _ smallerUnit: CFCalendarUnit, _ biggerUnit: CFCalendarUnit, _ at: CFAbsoluteTime) -> CFRange
```

## Parameters

- `calendar`: The calendar to examine.
- `smallerUnit`: A calendar unit. For valid values see doc://com.apple.corefoundation/documentation/CoreFoundation/CFCalendarUnit.
- `biggerUnit`: A calendar unit. For valid values see doc://com.apple.corefoundation/documentation/CoreFoundation/CFCalendarUnit.
- `at`: An absolute time.

## Return Value

Return Value The range of values that the calendar unit specified by smallerUnit can take on within the calendar unit specified by biggerUnit that includes the absolute time at. For example, the range the Day unit can take on in the Month in which the absolute time lies.

## Discussion

Discussion If biggerUnit is not logically bigger than smallerUnit in the calendar, or the given combination of units does not make sense (or is a computation which is undefined), the result is {kCFNotFound, kCFNotFound}.

## See Also

### Getting Ranges of Units

- [CFCalendarGetOrdinalityOfUnit(_:_:_:_:)](corefoundation/cfcalendargetordinalityofunit(_:_:_:_:).md)
- [CFCalendarGetTimeRangeOfUnit(_:_:_:_:_:)](corefoundation/cfcalendargettimerangeofunit(_:_:_:_:_:).md)
- [CFCalendarGetMaximumRangeOfUnit(_:_:)](corefoundation/cfcalendargetmaximumrangeofunit(_:_:).md)
- [CFCalendarGetMinimumRangeOfUnit(_:_:)](corefoundation/cfcalendargetminimumrangeofunit(_:_:).md)
