getSeconds
getSeconds: (Duration) -> numberWhole seconds (floored: PT-0.5S is -1).
Duration.ofDays(…)
Duration.ofHours(…)
Duration.ofMinutes(…)| Method | Returns | Description |
|---|---|---|
getSeconds() | number | Whole seconds (floored: PT-0.5S is -1). |
getNano() | number | The nanos within the second, 0 to 999,999,999. |
isZero() | boolean | Whether it is zero long. |
isNegative() | boolean | Whether it is negative. |
plus(Duration) | Duration | (Duration, Duration) -> Duration: This plus duration. |
plus(number, ChronoUnit | RSTimeUnit) | Duration | |
minus(Duration) | Duration | (Duration, Duration) -> Duration: This less duration. |
minus(number, ChronoUnit | RSTimeUnit) | Duration | |
plusDays(number) | Duration | Plus daysToAdd days. |
plusHours(number) | Duration | Plus hoursToAdd hours. |
plusMinutes(number) | Duration | Plus minutesToAdd minutes. |
plusSeconds(number) | Duration | Plus secondsToAdd seconds. |
plusMillis(number) | Duration | Plus millisToAdd ms. |
plusNanos(number) | Duration | Plus nanosToAdd ns. |
minusDays(number) | Duration | Less daysToSubtract days. |
minusHours(number) | Duration | Less hoursToSubtract hours. |
minusMinutes(number) | Duration | Less minutesToSubtract minutes. |
minusSeconds(number) | Duration | Less secondsToSubtract seconds. |
minusMillis(number) | Duration | Less millisToSubtract ms. |
minusNanos(number) | Duration | Less nanosToSubtract ns. |
multipliedBy(number) | Duration | This × multiplicand. |
dividedBy(number) | Duration | (Duration, number) -> Duration: This ÷ divisor, truncated toward zero. |
dividedBy(Duration) | number | |
negated() | Duration | This negated. |
abs() | Duration | This without its sign. |
toDays() | number | Whole days (getSeconds() / 86400). |
toHours() | number | Whole hours. |
toMinutes() | number | Whole minutes. |
toSeconds() | number | Whole seconds (getSeconds()). |
toMillis() | number | Total milliseconds; a negative fraction counts toward zero (PT-0.0005S is 0). |
toNanos() | number | Total nanoseconds. |
toDaysPart() | number | The days part. |
toHoursPart() | number | The hours part, 0 to 23 (negative for a negative duration). |
toMinutesPart() | number | The minutes part, 0 to 59. |
toSecondsPart() | number | The seconds part, 0 to 59. |
toMillisPart() | number | The milliseconds part, 0 to 999. |
toNanosPart() | number | The nanoseconds part. |
withSeconds(number) | Duration | The same nanos with seconds seconds. |
withNanos(number) | Duration | The same seconds with nanoOfSecond nanos. |
truncatedTo(ChronoUnit | RSTimeUnit) | Duration | Truncated to unit (the unit must divide a day). |
compareTo(Duration) | number | The seconds compared, then the nanos subtracted. |
equals(any) | boolean | Whether other is an equal Duration. |
hashCode() | number | The value's hash. |
toString() | string | ISO-8601, PT8H6M12.345S. |
ofDays(number) | Duration | days × 86,400 s. |
ofHours(number) | Duration | hours × 3,600 s. |
ofMinutes(number) | Duration | minutes × 60 s. |
ofSeconds(number) | Duration | (number) -> Duration: seconds s. |
ofSeconds(number, number) | Duration | |
ofMillis(number) | Duration | millis ms. |
ofNanos(number) | Duration | nanos ns. |
of(number, ChronoUnit | RSTimeUnit) | Duration | amount of unit: a ChronoUnit with an exact duration (or DAYS), or an RSTimeUnit (Duration.of(5, RSTimeUnit.GAME_TICKS) is 3 s). |
between(Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime, Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime) | Duration | The duration from startInclusive to endExclusive, negative when the end is earlier: two Instants, two LocalTimes, two `LocalDateTim… |
parse(string) | Duration | ISO-8601 PnDTnHnMn.nS, as toString writes it. |
| Field | Type | Description |
|---|---|---|
ZERO | Duration | The zero duration, PT0S. |
| Method | Returns | Description |
|---|---|---|
ChronoUnit.getDuration | Duration | The unit's duration (estimated from DAYS on: a month is 31,556,952 s / 12). |
DurationClass.between | Duration | The duration from startInclusive to endExclusive, negative when the end is earlier: two Instants, two LocalTimes, two `LocalDateTim… |
DurationClass.of | Duration | amount of unit: a ChronoUnit with an exact duration (or DAYS), or an RSTimeUnit (Duration.of(5, RSTimeUnit.GAME_TICKS) is 3 s). |
DurationClass.ofDays | Duration | days × 86,400 s. |
DurationClass.ofHours | Duration | hours × 3,600 s. |
DurationClass.ofMillis | Duration | millis ms. |
DurationClass.ofMinutes | Duration | minutes × 60 s. |
DurationClass.ofNanos | Duration | nanos ns. |
DurationClass.ofSeconds | Duration | (number) -> Duration: seconds s. |
DurationClass.parse | Duration | ISO-8601 PnDTnHnMn.nS, as toString writes it. |
LoopTimer.getDuration | Duration | The period. |
Timer.getDuration | Duration | From start to end. |
getSecondsgetSeconds: (Duration) -> numberWhole seconds (floored: PT-0.5S is -1).
getNanogetNano: (Duration) -> numberThe nanos within the second, 0 to 999,999,999.
isZeroisZero: (Duration) -> booleanWhether it is zero long.
isNegativeisNegative: (Duration) -> booleanWhether it is negative.
plusplus: ((Duration, Duration) -> Duration) & ((Duration, number, ChronoUnit | RSTimeUnit) -> Duration)(Duration, Duration) -> Duration: This plus duration.
(Duration, number, ChronoUnit | RSTimeUnit) -> Duration: This plus amountToAdd of unit.
minusminus: ((Duration, Duration) -> Duration) & ((Duration, number, ChronoUnit | RSTimeUnit) -> Duration)(Duration, Duration) -> Duration: This less duration.
(Duration, number, ChronoUnit | RSTimeUnit) -> Duration: This less amountToSubtract of unit.
plusDaysplusDays: (Duration, number) -> DurationPlus daysToAdd days.
plusHoursplusHours: (Duration, number) -> DurationPlus hoursToAdd hours.
plusMinutesplusMinutes: (Duration, number) -> DurationPlus minutesToAdd minutes.
plusSecondsplusSeconds: (Duration, number) -> DurationPlus secondsToAdd seconds.
plusMillisplusMillis: (Duration, number) -> DurationPlus millisToAdd ms.
plusNanosplusNanos: (Duration, number) -> DurationPlus nanosToAdd ns.
minusDaysminusDays: (Duration, number) -> DurationLess daysToSubtract days.
minusHoursminusHours: (Duration, number) -> DurationLess hoursToSubtract hours.
minusMinutesminusMinutes: (Duration, number) -> DurationLess minutesToSubtract minutes.
minusSecondsminusSeconds: (Duration, number) -> DurationLess secondsToSubtract seconds.
minusMillisminusMillis: (Duration, number) -> DurationLess millisToSubtract ms.
minusNanosminusNanos: (Duration, number) -> DurationLess nanosToSubtract ns.
multipliedBymultipliedBy: (Duration, number) -> DurationThis × multiplicand.
dividedBydividedBy: ((Duration, number) -> Duration) & ((Duration, Duration) -> number)(Duration, number) -> Duration: This ÷ divisor, truncated toward zero.
(Duration, Duration) -> number: How many whole divisors fit in this.
negatednegated: (Duration) -> DurationThis negated.
absabs: (Duration) -> DurationThis without its sign.
toDaystoDays: (Duration) -> numberWhole days (getSeconds() / 86400).
toHourstoHours: (Duration) -> numberWhole hours.
toMinutestoMinutes: (Duration) -> numberWhole minutes.
toSecondstoSeconds: (Duration) -> numberWhole seconds (getSeconds()).
toMillistoMillis: (Duration) -> numberTotal milliseconds; a negative fraction counts toward zero (PT-0.0005S is 0).
toNanostoNanos: (Duration) -> numberTotal nanoseconds.
toDaysParttoDaysPart: (Duration) -> numberThe days part.
toHoursParttoHoursPart: (Duration) -> numberThe hours part, 0 to 23 (negative for a negative duration).
toMinutesParttoMinutesPart: (Duration) -> numberThe minutes part, 0 to 59.
toSecondsParttoSecondsPart: (Duration) -> numberThe seconds part, 0 to 59.
toMillisParttoMillisPart: (Duration) -> numberThe milliseconds part, 0 to 999.
toNanosParttoNanosPart: (Duration) -> numberThe nanoseconds part.
withSecondswithSeconds: (Duration, number) -> DurationThe same nanos with seconds seconds.
withNanoswithNanos: (Duration, number) -> DurationThe same seconds with nanoOfSecond nanos.
truncatedTotruncatedTo: (Duration, ChronoUnit | RSTimeUnit) -> DurationTruncated to unit (the unit must divide a day).
compareTocompareTo: (Duration, Duration) -> numberThe seconds compared, then the nanos subtracted.
equalsequals: (Duration, any) -> booleanWhether other is an equal Duration.
hashCodehashCode: (Duration) -> numberThe value's hash.
toStringtoString: (Duration) -> stringISO-8601, PT8H6M12.345S.
ofDaysofDays: (number) -> Durationdays × 86,400 s.
ofHoursofHours: (number) -> Durationhours × 3,600 s.
ofMinutesofMinutes: (number) -> Durationminutes × 60 s.
ofSecondsofSeconds: ((number) -> Duration) & ((number, number) -> Duration)(number) -> Duration: seconds s.
(number, number) -> Duration: seconds s plus nanoAdjustment ns.
ofMillisofMillis: (number) -> Durationmillis ms.
ofNanosofNanos: (number) -> Durationnanos ns.
ofof: (number, ChronoUnit | RSTimeUnit) -> Durationamount of unit: a ChronoUnit with an exact duration (or DAYS), or an RSTimeUnit (Duration.of(5, RSTimeUnit.GAME_TICKS) is 3 s).
betweenbetween: (Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime, Instant | LocalTime | LocalDate | LocalDateTime | ZonedDateTime) -> DurationThe duration from startInclusive to endExclusive, negative when the end is earlier: two Instants, two LocalTimes, two LocalDateTimes, ... (the end is converted to the start's type).
parseparse: (string) -> DurationISO-8601 PnDTnHnMn.nS, as toString writes it.