---
title: "predicate(forActivitySummariesBetweenStart:end:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkquery/predicate(foractivitysummariesbetweenstart:end:)"
---

# predicate(forActivitySummariesBetweenStart:end:)

Returns a predicate for matching all the activity summaries that fall between the days identified by the start and end date components.

## Declaration

```swift
class func predicate(forActivitySummariesBetweenStart startDateComponents: DateComponents, end endDateComponents: DateComponents) -> NSPredicate
```

## Parameters

- `startDateComponents`: Date components that uniquely identify the start day as perceived by the user. This day may be longer or shorter than 24 hours (for example, if the user traveled across time zones). The date components must have a valid doc://com.apple.documentation/documentation/Foundation/NSDateComponents/calendar property.
- `endDateComponents`: Date components that uniquely identify the end day as perceived by the user. This day may be longer or shorter than 24 hours (for example, if the user traveled across time zones). The date components must have a valid doc://com.apple.documentation/documentation/Foundation/NSDateComponents/calendar property.

## Return Value

Return Value A predicate for matching activity summaries spanning a range of days.

## Discussion

Discussion Use this convenience method to create a predicate that matches activity summaries that fall between the specified days. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

## See Also

### Related Documentation

- [HKPredicateKeyPathDateComponents](healthkit/hkpredicatekeypathdatecomponents.md)

### Creating activity summary predicates

- [predicateForActivitySummary(with:)](healthkit/hkquery/predicateforactivitysummary(with:).md)
