TimeUnit

Methods
16
Fields
7

Getting one

TimeUnit.valueOf(…)
TimeUnit.NANOSECONDS
TimeUnit.MICROSECONDS

Methods

MethodReturnsDescription
name()stringThe constant's name as declared.
ordinal()numberThe constant's 0-based position in values().
toString()stringThe constant's printed name; tostring(c) answers the same.
compareTo(TimeUnit)numberThis ordinal less other's.
equals(any)booleanWhether other is this constant. == answers the same.
toNanos(number)numberduration of this unit in nanoseconds.
toMicros(number)numberduration of this unit in microseconds.
toMillis(number)numberduration of this unit in milliseconds.
toSeconds(number)numberduration of this unit in seconds.
toMinutes(number)numberduration of this unit in minutes.
toHours(number)numberduration of this unit in hours.
toDays(number)numberduration of this unit in days.
convert(number, TimeUnit)numbersourceDuration of sourceUnit in this unit.
toChronoUnit()ChronoUnitThe ChronoUnit of the same length.
values(){TimeUnit}Every constant in ordinal order, as a new 1-based array.
valueOf(string)TimeUnitThe constant named name; any other name is an error.

Fields

FieldTypeDescription
NANOSECONDSTimeUnitTimeUnit.NANOSECONDS.
MICROSECONDSTimeUnitTimeUnit.MICROSECONDS.
MILLISECONDSTimeUnitTimeUnit.MILLISECONDS.
SECONDSTimeUnitTimeUnit.SECONDS.
MINUTESTimeUnitTimeUnit.MINUTES.
HOURSTimeUnitTimeUnit.HOURS.
DAYSTimeUnitTimeUnit.DAYS.

Returned by

MethodReturnsDescription
TimeUnitClass.valueOfTimeUnitThe constant named name; any other name is an error.
TimeUnitClass.values{TimeUnit}Every constant in ordinal order, as a new 1-based array.

Method details

name

name: (TimeUnit) -> string

The constant's name as declared.

ordinal

ordinal: (TimeUnit) -> number

The constant's 0-based position in values().

toString

toString: (TimeUnit) -> string

The constant's printed name; tostring(c) answers the same.

equals

equals: (TimeUnit, any) -> boolean

Whether other is this constant. == answers the same.

toNanos

toNanos: (TimeUnit, number) -> number

duration of this unit in nanoseconds.

toMicros

toMicros: (TimeUnit, number) -> number

duration of this unit in microseconds.

toMillis

toMillis: (TimeUnit, number) -> number

duration of this unit in milliseconds.

toHours

toHours: (TimeUnit, number) -> number

duration of this unit in hours.

toDays

toDays: (TimeUnit, number) -> number

duration of this unit in days.

values

values: () -> {TimeUnit}

Every constant in ordinal order, as a new 1-based array.

valueOf

valueOf: (string) -> TimeUnit

The constant named name; any other name is an error.