<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKWorkoutBuilder/elapsedTime(at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKWorkoutBuilder(im)elapsedTimeAtDate:"
  },
  "title" : "elapsedTime(at:)"
}
-->

# elapsedTime(at:)

Calculates the duration of the workout at the specified time.

```
func elapsedTime(at date: Date) -> TimeInterval
```

## Parameters

`date`

The end date to use to calculate the duration.

## Discussion

The duration of a workout doesn’t include intervals between pause and resume events.

> Note:
> The duration of a workout can decrease when you add past occurrences of pause events.

---

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)