Note: As of July 10, 2024, watch faces must use the Watch Face Format in order to be installed on new watches that launch with Wear OS 5 pre-installed. Learn more about the user-facing changes in this Help Center article.

Additionally, starting in early 2025 (specific date to be announced during Q4 2024), all new watch faces published on Google Play must use the Watch Face Format.

public final class TimeRange


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

Summary

Public fields

static final @NonNull TimeRange

The TimeRange that includes every point in time.

Public methods

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

Constructs a time range after a given point in time.

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

Constructs a time range until a given point in time.

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.

final boolean
contains(@NonNull Instant dateTimeMillis)

Returns whether the TimeRange contains a given point in time.

boolean
equals(Object other)
final @NonNull Instant
final @NonNull Instant
int
@NonNull String

Public fields

ALWAYS

public static final @NonNull TimeRange ALWAYS

The TimeRange that includes every point in time.

Public methods

after

Added in 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
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
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
public final boolean contains(@NonNull Instant dateTimeMillis)

Returns whether the TimeRange contains a given point in time.

equals

public boolean equals(Object other)

getEndDateTimeMillis

Added in 1.0.0
public final @NonNull Instant getEndDateTimeMillis()

getStartDateTimeMillis

Added in 1.0.0
public final @NonNull Instant getStartDateTimeMillis()

hashCode

public int hashCode()

toString

public @NonNull String toString()