# 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)

*** ** * ** ***


```
public enum TimeDifferenceStyle extends Enum<@NonNull TimeDifferenceStyle>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [kotlin.Enum](https://developer.android.com/reference/java/lang/Enum.html)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [TimeDifferenceStyle](https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceStyle)\> ||
|   | ↳ | [androidx.wear.watchface.complications.data.TimeDifferenceStyle](https://developer.android.com/reference/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/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/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/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/androidx/wear/watchface/complications/data/TimeDifferenceStyle#STOPWATCH` | Style for time differences shown in a numeric fashion like a timer. |
| `https://developer.android.com/reference/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 methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceStyle>` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceStyle#getEntries()()` 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. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceStyle` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceStyle#valueOf(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value)` Returns the enum constant of this type with the specified name. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull TimeDifferenceStyle[]` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceStyle#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### SHORT_DUAL_UNIT

```
TimeDifferenceStyle TimeDifferenceStyle.SHORT_DUAL_UNIT
```

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

```
TimeDifferenceStyle TimeDifferenceStyle.SHORT_SINGLE_UNIT
```

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

```
TimeDifferenceStyle 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.

The output will be the same as for `https://developer.android.com/reference/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

```
TimeDifferenceStyle TimeDifferenceStyle.STOPWATCH
```

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

```
TimeDifferenceStyle TimeDifferenceStyle.WORDS_SINGLE_UNIT
```

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 methods

### getEntries

```
public final @NonNull EnumEntries<@NonNull TimeDifferenceStyle> getEntries()
```

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.

### valueOf

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

```
public static final @NonNull TimeDifferenceStyle valueOf(@NonNull String value)
```

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)

```
public static final @NonNull TimeDifferenceStyle[] values()
```

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.