Skip to content

Type Method

hourMinuteSecond(padHourToLength:fractionalSecondsLength:roundFractionalSeconds:)

iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+ macOS 13.0+ tvOS 16.0+ watchOS 9.0+
Displays a duration in terms of hours, minutes, and seconds with the specified configurations.
static func hourMinuteSecond(padHourToLength: Int, fractionalSecondsLength: Int = 0, roundFractionalSeconds: FloatingPointRoundingRule = .toNearestOrEven) -> Duration.TimeFormatStyle.Pattern

Parameters

padHourToLength

Padding for the hour field. For example, one hour is formatted as “01:00:00” in en_US locale when this value is set to 2.

fractionalSecondsLength

The length of the fractional seconds. For example, one hour is formatted as “1:00:00.00” in en_US locale when this value is set to 2.

roundFractionalSeconds

Rounding rule for the fractional second values.

Return Value

A pattern to format a duration with.