---
title: "dateInterval(of:start:interval:for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/calendar/dateinterval(of:start:interval:for:)"
---

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

Returns, via two inout parameters, the starting time and duration of a given calendar component that contains a given date.

## Declaration

```swift
func dateInterval(of component: Calendar.Component, start: inout Date, interval: inout TimeInterval, for date: Date) -> Bool
```

## Parameters

- `component`: A calendar component.
- `start`: Upon return, the starting time of the calendar component that contains the date.
- `interval`: Upon return, the duration of the calendar component that contains the date.
- `date`: The specified date.

## Return Value

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

## See Also

### Calculating Intervals

- [dateInterval(of:for:)](foundation/calendar/dateinterval(of:for:).md)
- [dateIntervalOfWeekend(containing:)](foundation/calendar/dateintervalofweekend(containing:).md)
- [dateIntervalOfWeekend(containing:start:interval:)](foundation/calendar/dateintervalofweekend(containing:start:interval:).md)
- [nextWeekend(startingAfter:direction:)](foundation/calendar/nextweekend(startingafter:direction:).md)
- [nextWeekend(startingAfter:start:interval:direction:)](foundation/calendar/nextweekend(startingafter:start:interval:direction:).md)
- [Calendar.SearchDirection](foundation/calendar/searchdirection.md)
