# DynamicBuilders.DynamicDuration

Artifact: [androidx.wear.protolayout:protolayout-expression](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/expression/DynamicBuilders.java+class:androidx.wear.protolayout.expression.DynamicBuilders.DynamicDuration) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***

<br />

```
@RequiresSchemaVersion(major = 1, minor = 200)
interface DynamicBuilders.DynamicDuration : DynamicBuilders.DynamicType
```

<br />

*** ** * ** ***

Interface defining a dynamic duration type.

## Summary

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 300) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#from(androidx.wear.protolayout.expression.DynamicDataKey<androidx.wear.protolayout.expression.DynamicBuilders.DynamicDuration>)(dynamicDataKey: https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration!>)` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` that is bound to the value of an item of the State. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#fromByteArray(byte[])(byteArray: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>)` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` from a byte array generated by `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toDynamicDurationByteArray()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#fromByteArray(byte[],int,int)(byteArray: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` from the provided byte array at the provided offset and length, that was generated by one of the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toDynamicDurationByteArray()` overloads. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#getHoursPart()()` Returns the number of hours part in the duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#getIntDaysPart()()` Returns the total number of days in a duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#getMinutesPart()()` Returns the number of minutes part in the duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#getSecondsPart()()` Returns the number of seconds part in the duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/ConditionScopes.ConditionScope<https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration!, https://developer.android.com/reference/java/time/Duration.html!>` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#onCondition(androidx.wear.protolayout.expression.DynamicBuilders.DynamicBool)(condition: https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicBool)` Bind the value of this `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` to the result of a conditional expression. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toDynamicDurationByteArray()()` Serializes the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` into a new byte array that can later be used with `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#fromByteArray(byte[])`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toDynamicDurationByteArray(byte[])(byteArray: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>)` Serializes the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` into the provided byte array, returning the amount of bytes written, that can later be used with `DynamicDuration.fromByteArray( byteArray, 0, bytesWritten)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toDynamicDurationByteArray(byte[],int,int)( byteArray: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Serializes the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with `DynamicDuration.fromByteArray(byteArray, offset, bytesWritten)`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toIntDays()()` Returns the total number of days in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toIntHours()()` Returns the total number of hours in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toIntMinutes()()` Returns the total number of minutes in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toIntSeconds()()` Returns the total number of seconds in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` | `@https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#withSecondsPrecision(java.time.Duration)(duration: https://developer.android.com/reference/java/time/Duration.html)` Creates a constant-valued `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` from a `https://developer.android.com/reference/java/time/Duration.html`. |

## Public functions

### from

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.1.0)

```
@RequiresSchemaVersion(major = 1, minor = 300)
java-static fun from(dynamicDataKey: DynamicDataKey<DynamicBuilders.DynamicDuration!>): DynamicBuilders.DynamicDuration
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` that is bound to the value of an item of the State.

| Parameters |
|---|---|
| `dynamicDataKey: https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicDataKey<https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration!>` | The source key to a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicDataBuilders.DynamicDataValue` with an `https://developer.android.com/reference/java/time/Duration.html` value. |

### fromByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
java-static fun fromByteArray(byteArray: ByteArray<Byte>): DynamicBuilders.DynamicDuration
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` from a byte array generated by `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toDynamicDurationByteArray()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array does not contain a valid serialization |

### fromByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
java-static fun fromByteArray(byteArray: ByteArray<Byte>, offset: Int, length: Int): DynamicBuilders.DynamicDuration
```

Creates a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` from the provided byte array at the provided offset and length, that was generated by one of the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#toDynamicDurationByteArray()` overloads.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array does not contain a valid serialization in the provided offset and length |

### getHoursPart

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun getHoursPart(): DynamicBuilders.DynamicInt32
```

Returns the number of hours part in the duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. This represents the absolute value of remaining hours when dividing total hours by hours in a day (24 hours); As an example, the following is equal to ` DynamicInt32.constant(10)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getHoursPart();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. |

### getIntDaysPart

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun getIntDaysPart(): DynamicBuilders.DynamicInt32
```

Returns the total number of days in a duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. This represents the absolute value of the total number of days in the duration based on the 24 hours day definition. The fraction part of the result will be truncated; As an example, the following is equal to `DynamicInt32.constant(1)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getIntDaysPart();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. Integer overflow can occur if the result of the operation is larger than `https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE`. |

### getMinutesPart

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun getMinutesPart(): DynamicBuilders.DynamicInt32
```

Returns the number of minutes part in the duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. This represents the absolute value of remaining minutes when dividing total minutes by minutes in an hour (60 minutes). As an example, the following is equal to ` DynamicInt32.constant(17)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getMinutesPart();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. |

### getSecondsPart

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun getSecondsPart(): DynamicBuilders.DynamicInt32
```

Returns the number of seconds part in the duration as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. This represents the absolute value of remaining seconds when dividing total seconds by seconds in a minute (60 seconds); As an example, the following is equal to ` DynamicInt32.constant(36)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getSecondsPart();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. |

### onCondition

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun onCondition(condition: DynamicBuilders.DynamicBool): ConditionScopes.ConditionScope<DynamicBuilders.DynamicDuration!, Duration!>
```

Bind the value of this `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` to the result of a conditional expression. This will use the value given in either `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/ConditionScopes.ConditionScope#use(T)` or `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/ConditionScopes.IfTrueScope#elseUse(T)` depending on the value yielded from ` condition`.

### toDynamicDurationByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
fun toDynamicDurationByteArray(): Array<Byte>
```

Serializes the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` into a new byte array that can later be used with `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration#fromByteArray(byte[])`.

### toDynamicDurationByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
fun toDynamicDurationByteArray(byteArray: ByteArray<Byte>): Int
```

Serializes the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` into the provided byte array, returning the amount of bytes written, that can later be used with `DynamicDuration.fromByteArray( byteArray, 0, bytesWritten)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array is too small |

### toDynamicDurationByteArray

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
fun toDynamicDurationByteArray(
    byteArray: ByteArray<Byte>,
    offset: Int,
    length: Int
): Int
```

Serializes the `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with `DynamicDuration.fromByteArray(byteArray, offset, bytesWritten)`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the byte array is too small |

### toIntDays

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntDays(): DynamicBuilders.DynamicInt32
```

Returns the total number of days in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. The fraction part of the result will be truncated. This is based on the standard definition of a day as 24 hours. As an example, the following is equal to ` DynamicInt32.constant(1)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntDays();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. Integer overflow can occur if the result of the operation is larger than `https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE`. |

### toIntHours

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntHours(): DynamicBuilders.DynamicInt32
```

Returns the total number of hours in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. The fraction part of the result will be truncated. As an example, the following is equal to `DynamicInt32.constant(34)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntHours();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. Integer overflow can occur if the result of the operation is larger than `https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE`. |

### toIntMinutes

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntMinutes(): DynamicBuilders.DynamicInt32
```

Returns the total number of minutes in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. The fraction part of the result will be truncated. As an example, the following is equal to `DynamicInt32.constant(2057)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntMinutes();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. Integer overflow can occur if the result of the operation is larger than `https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE`. |

### toIntSeconds

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntSeconds(): DynamicBuilders.DynamicInt32
```

Returns the total number of seconds in a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` as a `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32`. As an example, the following is equal to ` DynamicInt32.constant(123456)`

```kotlin
  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntSeconds();
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` | a new instance of `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicInt32` containing the result of the operation. Integer overflow can occur if the result of the operation is larger than `https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE`. |

### withSecondsPrecision

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun withSecondsPrecision(duration: Duration): DynamicBuilders.DynamicDuration
```

Creates a constant-valued `https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/DynamicBuilders.DynamicDuration` from a `https://developer.android.com/reference/java/time/Duration.html`. If `https://developer.android.com/reference/java/time/Duration.html` precision is greater than seconds, then any excess precision information will be dropped.