name
name: (ChronoUnit) -> stringThe constant's name as declared.
ChronoUnit.valueOf(…)
ChronoUnit.NANOS
ChronoUnit.MICROS| Method | Returns | Description |
|---|---|---|
name() | string | The constant's name as declared. |
ordinal() | number | The constant's 0-based position in values(). |
toString() | string | The constant's printed name; tostring(c) answers the same. |
compareTo(ChronoUnit) | number | This ordinal less other's. |
equals(any) | boolean | Whether other is this constant. == answers the same. |
getDuration() | Duration | The unit's duration (estimated from DAYS on: a month is 31,556,952 s / 12). |
isDurationEstimated() | boolean | Whether the duration is an estimate: DAYS and longer. |
isDateBased() | boolean | Whether it is a date unit: DAYS to ERAS. |
isTimeBased() | boolean | Whether it is a time unit: shorter than DAYS. |
between(Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime, Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime) | number | Whole 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) | ChronoUnit | The constant named name; any other name is an error. |
| Field | Type | Description |
|---|---|---|
NANOS | ChronoUnit | ChronoUnit.NANOS. |
MICROS | ChronoUnit | ChronoUnit.MICROS. |
MILLIS | ChronoUnit | ChronoUnit.MILLIS. |
SECONDS | ChronoUnit | ChronoUnit.SECONDS. |
MINUTES | ChronoUnit | ChronoUnit.MINUTES. |
HOURS | ChronoUnit | ChronoUnit.HOURS. |
HALF_DAYS | ChronoUnit | ChronoUnit.HALF_DAYS. |
DAYS | ChronoUnit | ChronoUnit.DAYS. |
WEEKS | ChronoUnit | ChronoUnit.WEEKS. |
MONTHS | ChronoUnit | ChronoUnit.MONTHS. |
YEARS | ChronoUnit | ChronoUnit.YEARS. |
DECADES | ChronoUnit | ChronoUnit.DECADES. |
CENTURIES | ChronoUnit | ChronoUnit.CENTURIES. |
MILLENNIA | ChronoUnit | ChronoUnit.MILLENNIA. |
ERAS | ChronoUnit | ChronoUnit.ERAS. |
FOREVER | ChronoUnit | ChronoUnit.FOREVER. |
| Method | Returns | Description |
|---|---|---|
ChronoUnitClass.valueOf | ChronoUnit | The constant named name; any other name is an error. |
ChronoUnitClass.values | {ChronoUnit} | Every constant in ordinal order, as a new 1-based array. |
TimeUnit.toChronoUnit | ChronoUnit | The ChronoUnit of the same length. |
namename: (ChronoUnit) -> stringThe constant's name as declared.
ordinalordinal: (ChronoUnit) -> numberThe constant's 0-based position in values().
toStringtoString: (ChronoUnit) -> stringThe constant's printed name; tostring(c) answers the same.
compareTocompareTo: (ChronoUnit, ChronoUnit) -> numberThis ordinal less other's.
equalsequals: (ChronoUnit, any) -> booleanWhether other is this constant. == answers the same.
getDurationgetDuration: (ChronoUnit) -> DurationThe unit's duration (estimated from DAYS on: a month is 31,556,952 s / 12).
isDurationEstimatedisDurationEstimated: (ChronoUnit) -> booleanWhether the duration is an estimate: DAYS and longer.
isDateBasedisDateBased: (ChronoUnit) -> booleanWhether it is a date unit: DAYS to ERAS.
isTimeBasedisTimeBased: (ChronoUnit) -> booleanWhether it is a time unit: shorter than DAYS.
betweenbetween: (ChronoUnit, Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime, Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime) -> numberWhole units from the first to the second (first:until(second, unit)).
valuesvalues: () -> {ChronoUnit}Every constant in ordinal order, as a new 1-based array.
valueOfvalueOf: (string) -> ChronoUnitThe constant named name; any other name is an error.