ChronoUnit

Methods
12
Fields
16

Getting one

ChronoUnit.valueOf(…)
ChronoUnit.NANOS
ChronoUnit.MICROS

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(ChronoUnit)numberThis ordinal less other's.
equals(any)booleanWhether other is this constant. == answers the same.
getDuration()DurationThe unit's duration (estimated from DAYS on: a month is 31,556,952 s / 12).
isDurationEstimated()booleanWhether the duration is an estimate: DAYS and longer.
isDateBased()booleanWhether it is a date unit: DAYS to ERAS.
isTimeBased()booleanWhether it is a time unit: shorter than DAYS.
between(Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime, Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime)numberWhole units from the first to the second (first:until(second, unit)).
values(){ChronoUnit}Every constant in ordinal order, as a new 1-based array.
valueOf(string)ChronoUnitThe constant named name; any other name is an error.

Fields

FieldTypeDescription
NANOSChronoUnitChronoUnit.NANOS.
MICROSChronoUnitChronoUnit.MICROS.
MILLISChronoUnitChronoUnit.MILLIS.
SECONDSChronoUnitChronoUnit.SECONDS.
MINUTESChronoUnitChronoUnit.MINUTES.
HOURSChronoUnitChronoUnit.HOURS.
HALF_DAYSChronoUnitChronoUnit.HALF_DAYS.
DAYSChronoUnitChronoUnit.DAYS.
WEEKSChronoUnitChronoUnit.WEEKS.
MONTHSChronoUnitChronoUnit.MONTHS.
YEARSChronoUnitChronoUnit.YEARS.
DECADESChronoUnitChronoUnit.DECADES.
CENTURIESChronoUnitChronoUnit.CENTURIES.
MILLENNIAChronoUnitChronoUnit.MILLENNIA.
ERASChronoUnitChronoUnit.ERAS.
FOREVERChronoUnitChronoUnit.FOREVER.

Returned by

MethodReturnsDescription
ChronoUnitClass.valueOfChronoUnitThe constant named name; any other name is an error.
ChronoUnitClass.values{ChronoUnit}Every constant in ordinal order, as a new 1-based array.
TimeUnit.toChronoUnitChronoUnitThe ChronoUnit of the same length.

Method details

toString

toString: (ChronoUnit) -> string

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

equals

equals: (ChronoUnit, any) -> boolean

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

values

values: () -> {ChronoUnit}

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

valueOf

valueOf: (string) -> ChronoUnit

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