<!--
{
  "availability" : [
    "iOS: 9.3.0 -",
    "iPadOS: 9.3.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQuery/predicate(forActivitySummariesBetweenStart:end:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQuery(cm)predicateForActivitySummariesBetweenStartDateComponents:endDateComponents:"
  },
  "title" : "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.

```
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

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

## 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.

```objc
NSPredicate *forDay =
[HKQuery HKQuery.predicateForActivitySummariesBetweenStartDateComponents: startDateComponents endDateComponents:endDateComponents];
 
NSPredicate *explicitforDay =
[NSPredicate predicateWithFormat:@"%K >= %@ AND %K <= %@",
 HKPredicateKeyPathDateComponents, startDateComponents,
 HKPredicateKeyPathDateComponents, endDateComponents];
```

## See Also

[`HKPredicateKeyPathDateComponents`](/documentation/HealthKit/HKPredicateKeyPathDateComponents)

The key path for accessing an activity summary’s date components.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)