# TimeDifferenceStyle

Artifact: [androidx.wear.watchface:watchface-complications-data](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/data/Text.kt+class:androidx.wear.watchface.complications.data.TimeDifferenceStyle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***


```
enum TimeDifferenceStyle : Enum<TimeDifferenceStyle>
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [kotlin.Enum](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-enum/index.html)\<[TimeDifferenceStyle](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle)\> ||
|   | ↳ | [androidx.wear.watchface.complications.data.TimeDifferenceStyle](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle) |

*** ** * ** ***

The styling used for showing a time different by ComplicationText#TimeDifferenceBuilder.

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#SHORT_DUAL_UNIT` | Style for time differences shown in a short alpha-numeric style, with up to two significant units included. |
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#SHORT_SINGLE_UNIT` | Style for time differences shown in a short alpha-numeric style, with only the most significant unit included. |
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#SHORT_WORDS_SINGLE_UNIT` | Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included, that should fit within the character limit for a short text field. |
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#STOPWATCH` | Style for time differences shown in a numeric fashion like a timer. |
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#WORDS_SINGLE_UNIT` | Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#valueOf(kotlin.String)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Returns the enum constant of this type with the specified name. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle>` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html<https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle>` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#entries()` Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared. |

## Enum Values

### SHORT_DUAL_UNIT

```
val TimeDifferenceStyle.SHORT_DUAL_UNIT: TimeDifferenceStyle
```

Style for time differences shown in a short alpha-numeric style, with up to two significant units included.

For time difference `t`:

If `t < 1 hour`, the value will be shown as a number of minutes, such as `2m` for 2 minutes. Seconds are not displayed.

If `1 hour <= t < 1 day`, the value will be shown as hours and minutes, such as `4h 2m` for 4 hours and 2 minutes.

If `1 day <= t < 10 days`, the value will be shown as days and hours, such as `3d 4h` for 3 days 4 hours.

If `10 days <= t`, the value will be shown as a number of days, such as `13d` for 13 days.

The characters used will be localised to match the default locale. If the representation of the time difference with two units would be too long in the default locale, just a single unit may be shown instead.

### SHORT_SINGLE_UNIT

```
val TimeDifferenceStyle.SHORT_SINGLE_UNIT: TimeDifferenceStyle
```

Style for time differences shown in a short alpha-numeric style, with only the most significant unit included.

For time difference `t`:

If `t < 1 hour`, the value will be shown as a number of minutes, such as `2m` for 2 minutes . Seconds are not displayed.

If `1 hour <= t < 1 day`, the value will be shown as a number of hours, such as `4h` for 4 hours.

If `1 days <= t`, the value will be shown as a number of days, such as `13d` for 13 days.

The characters used will be localised to match the default locale.

### SHORT_WORDS_SINGLE_UNIT

```
val TimeDifferenceStyle.SHORT_WORDS_SINGLE_UNIT: TimeDifferenceStyle
```

Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included, that should fit within the character limit for a short text field.

The output will be the same as for `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceStyle#WORDS_SINGLE_UNIT`, except that if the text does not fit into the seven character limit then a shorter form will be used instead, e.g. `1356d` instead of `1356 days`.

### STOPWATCH

```
val TimeDifferenceStyle.STOPWATCH: TimeDifferenceStyle
```

Style for time differences shown in a numeric fashion like a timer.

For time difference `t`:

If `t < 1 hour`, the value will be shown as minutes and seconds, such as `02:35` for 2 minutes and 35 seconds.

If `1 hour <= t < 1 day`, the value will be shown as hours and minutes, such as `4:02` for 4 hours and 2 minutes, or as `12:02` for 12 hours and 2 minutes.

If `1 day <= t < 10 days`, the value will be shown as days and hours, such as `3d 4h` for 3 days 4 hours.

If `10 days <= t`, the value will be shown as just days, such as `13d` for 13 days.

The characters used will be localised to match the default locale.

### WORDS_SINGLE_UNIT

```
val TimeDifferenceStyle.WORDS_SINGLE_UNIT: TimeDifferenceStyle
```

Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included.

For time difference `t`:

If `t < 1 hour`, the value will be shown as a number of minutes, such as `1 min` for 1 minute or `2 mins` for 2 minutes. Seconds are not displayed.

If `1 hour <= t < 1 day`, the value will be shown as a number of hours, such as `1 hour` for 1 hour or `4 hours` for 4 hours.

If `1 days <= t`, the value will be shown as a number of days, such as `1 day` for 1 day or `13 days` for 13 days.

The words used will be localised to match the default locale.

## Public functions

### valueOf

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

```
fun valueOf(value: String): TimeDifferenceStyle
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this enum type has no constant with the specified name |

### values

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

```
fun values(): Array<TimeDifferenceStyle>
```

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.

The function returns a new instance of the array on every call. The array could be mutated, so working with it may also require defensive copying. Consider using `entries` property as a more efficient alternative returning an immutable list of enum entries.

## Public properties

### entries

```
val entries: EnumEntries<TimeDifferenceStyle>
```

Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared.