# TimeRange

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/Time.kt+class:androidx.wear.watchface.complications.data.TimeRange) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***


```
public final class TimeRange
```

<br />

*** ** * ** ***

A range of time, that may be unbounded on either side.

## Summary

| ### Public fields |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#ALWAYS()` The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` that includes every point in time. |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#after(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html startInstant)` Constructs a time range after a given point in time. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#before(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html endInstant)` Constructs a time range until a given point in time. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#between(java.time.Instant,java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html startInstant, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html endInstant)` Constructs a time range between two points in time, inclusive of the points themselves. |
| `final boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#contains(java.time.Instant)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html dateTimeMillis)` Returns whether the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` contains a given point in time. |
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#getEndDateTimeMillis()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#getStartDateTimeMillis()()` |
| `int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange#toString()()` |

## Public fields

### ALWAYS

```
public static final @NonNull TimeRange ALWAYS
```

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` that includes every point in time.

## Public methods

### after

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

```
public static final @NonNull TimeRange after(@NonNull Instant startInstant)
```

Constructs a time range after a given point in time.

### before

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

```
public static final @NonNull TimeRange before(@NonNull Instant endInstant)
```

Constructs a time range until a given point in time.

### between

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

```
public static final @NonNull TimeRange between(@NonNull Instant startInstant, @NonNull Instant endInstant)
```

Constructs a time range between two points in time, inclusive of the points themselves.

### contains

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

```
public final boolean contains(@NonNull Instant dateTimeMillis)
```

Returns whether the `https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange` contains a given point in time.

### equals

```
public boolean equals(Object other)
```

### getEndDateTimeMillis

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

```
public final @NonNull Instant getEndDateTimeMillis()
```

### getStartDateTimeMillis

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

```
public final @NonNull Instant getStartDateTimeMillis()
```

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```