LocalTime

public abstract class LocalTime implements Parcelable, Comparable


Represents a local time with just hours and minutes. This class is based on the class (available on SDK 26 and higher).

Summary

Public constructors

Public methods

int
abstract @IntRange(from = 0, to = 23) int

Returns the hours in 24 hour format (0 <= return value <24).

abstract @IntRange(from = 0, to = 59) int

Returns the minutes (0 <= return value <60).

static LocalTime
newInstance(
    @IntRange(from = 0, to = 23) int hours,
    @IntRange(from = 0, to = 59) int minutes
)

Returns a LocalTime instance given the hours and minutes.

Inherited Constants

From android.os.Parcelable
static final int
static final int
static final int
static final int

Inherited methods

From android.os.Parcelable
abstract int
int
abstract void
writeToParcel(Parcel p, int p1)

Public constructors

LocalTime

public LocalTime()

Public methods

compareTo

public int compareTo(LocalTime compare)

getHours

public abstract @IntRange(from = 0, to = 23) int getHours()

Returns the hours in 24 hour format (0 <= return value <24).

getMinutes

public abstract @IntRange(from = 0, to = 59) int getMinutes()

Returns the minutes (0 <= return value <60).

newInstance

public static LocalTime newInstance(
    @IntRange(from = 0, to = 23) int hours,
    @IntRange(from = 0, to = 59) int minutes
)

Returns a LocalTime instance given the hours and minutes.

Throws
java.lang.IllegalArgumentException

If parameters are out of range: 0 <= hours<24, 0 <= minutes<60, i.e. 00:00 to 23:59.