---
title: "secondUnit(with:)"
framework: healthkit
role: symbol
role_heading: Type Method
path: "healthkit/hkunit/secondunit(with:)"
---

# secondUnit(with:)

Returns a HealthKit unit for measuring time, using second units with the provided prefix.

## Declaration

```swift
class func secondUnit(with prefix: HKMetricPrefix) -> Self
```

## Parameters

- `prefix`: A valid metric prefix value. For the complete list of prefix values, see doc://com.apple.healthkit/documentation/HealthKit/HKMetricPrefix.

## Return Value

Return Value A HealthKit unit for measuring time based on seconds and the provided prefix.

## Discussion

Discussion This method is used to create prefixed versions of seconds. Common uses include creating millisecond units, as shown below.

## See Also

### Constructing time units

- [second()](healthkit/hkunit/second().md)
- [minute()](healthkit/hkunit/minute().md)
- [hour()](healthkit/hkunit/hour().md)
- [day()](healthkit/hkunit/day().md)
