# TimeRange

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeRange "View this page in Java")

<br />

```
class TimeRange
```

<br />

*** ** * ** ***

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

## Summary

|                                          ### Public companion functions                                          |
|------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange) | [after](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#after(java.time.Instant))`(startInstant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`)` Constructs a time range after a given point in time.                                                                                                                                                   |
| [TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange) | [before](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#before(java.time.Instant))`(endInstant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`)` Constructs a time range until a given point in time.                                                                                                                                                   |
| [TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange) | [between](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#between(java.time.Instant,java.time.Instant))`(startInstant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`, endInstant: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`)` Constructs a time range between two points in time, inclusive of the points themselves. |

|                                         ### Public companion properties                                          |
|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange) | [ALWAYS](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#ALWAYS()) The[TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange)that includes every point in time. |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)      | [contains](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#contains(java.time.Instant))`(dateTimeMillis: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`)` Returns whether the[TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange)contains a given point in time. |
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)`                                                                                                                                                                                     |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#hashCode())`()`                                                                                                                                                                                                                                                                                |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#toString())`()`                                                                                                                                                                                                                                                                                |

|                           ### Public properties                           |
|---------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [Instant](https://developer.android.com/reference/java/time/Instant.html) | [endDateTimeMillis](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#endDateTimeMillis())     |
| [Instant](https://developer.android.com/reference/java/time/Instant.html) | [startDateTimeMillis](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange#startDateTimeMillis()) |

## Public companion functions

### after

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

```
fun after(startInstant: Instant): TimeRange
```

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)  

```
fun before(endInstant: Instant): TimeRange
```

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)  

```
fun between(startInstant: Instant, endInstant: Instant): TimeRange
```

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

## Public companion properties

### ALWAYS

```
val ALWAYS: TimeRange
```

The[TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange)that includes every point in time.  

## Public functions

### contains

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

```
operator fun contains(dateTimeMillis: Instant): Boolean
```

Returns whether the[TimeRange](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeRange)contains a given point in time.  

### equals

```
open operator fun equals(other: Any?): Boolean
```  

### hashCode

```
open fun hashCode(): Int
```  

### toString

```
open fun toString(): String
```  

## Public properties

### endDateTimeMillis

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

```
val endDateTimeMillis: Instant
```  

### startDateTimeMillis

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

```
val startDateTimeMillis: Instant
```