<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKQuantitySeriesSampleQuery/orderByQuantitySampleStartDate",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKQuantitySeriesSampleQuery(py)orderByQuantitySampleStartDate"
  },
  "title" : "orderByQuantitySampleStartDate"
}
-->

# orderByQuantitySampleStartDate

A Boolean value that determines whether the query groups the results based on the quantity sample’s start date.

```
var orderByQuantitySampleStartDate: Bool { get set }
```

## Discussion

By default the query returns all the quantities in ascending order based on their start date. If you set this property to <doc://com.apple.documentation/documentation/Swift/true>, HealthKit first sorts the matching [`HKQuantitySample`](/documentation/HealthKit/HKQuantitySample) objects by their [`startDate`](/documentation/HealthKit/HKSample/startDate) parameter. Then, for each sample, it returns all the quantity objects in ascending order. If the sample objects overlap, then the quantities may not appear in ascending order when switching from one sample to the next.

---

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)