Calculates the amount of time until another instant _in terms of the specified unit.
!(p)
This calculates the amount of time between two {@code Instant}
objects _in terms of a single {@code TemporalUnit}.
The start and end points are {@code this} and the specified instant.
The result will be negative if the end is before the start.
The calculation returns a whole number, representing the number of
complete units between the two instants.
The {@code Temporal} passed to this method is converted to a
{@code Instant} using {@link #from(TemporalAccessor)}.
For example, the amount _in seconds between two dates can be calculated
using {@code startInstant.until(endInstant, SECONDS)}.
!(p)
There are two equivalent ways of using this method.
The first is to invoke this method.
The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
!(pre)
// these two lines are equivalent
amount = start.until(end, SECONDS);
amount = SECONDS.between(start, end);
</pre>
The choice should be made based on which makes the code more readable.
!(p)
The calculation is implemented _in this method for {@link ChronoUnit}.
The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS},
{@code MINUTES}, {@code HOURS}, {@code HALF_DAYS} and {@code DAYS}
are supported. Other {@code ChronoUnit} values will throw an exception.
!(p)
If the unit is not a {@code ChronoUnit}, then the result of this method
is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}
passing {@code this} as the first argument and the converted input temporal
as the second argument.
!(p)
This instance is immutable and unaffected by this method call.
@param endExclusive the end date, exclusive, which is converted to an {@code Instant}, not null
@param unit the unit to measure the amount _in, not null
@return the amount of time between this instant and the end instant
@throws DateTimeException if the amount cannot be calculated, or the end
temporal cannot be converted to an {@code Instant}
@throws UnsupportedTemporalTypeException if the unit is not supported
@throws ArithmeticException if numeric overflow occurs
Calculates the amount of time until another instant _in terms of the specified unit. !(p) This calculates the amount of time between two {@code Instant} objects _in terms of a single {@code TemporalUnit}. The start and end points are {@code this} and the specified instant. The result will be negative if the end is before the start. The calculation returns a whole number, representing the number of complete units between the two instants. The {@code Temporal} passed to this method is converted to a {@code Instant} using {@link #from(TemporalAccessor)}. For example, the amount _in seconds between two dates can be calculated using {@code startInstant.until(endInstant, SECONDS)}. !(p) There are two equivalent ways of using this method. The first is to invoke this method. The second is to use {@link TemporalUnit#between(Temporal, Temporal)}: !(pre) // these two lines are equivalent amount = start.until(end, SECONDS); amount = SECONDS.between(start, end); </pre> The choice should be made based on which makes the code more readable. !(p) The calculation is implemented _in this method for {@link ChronoUnit}. The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS}, {@code MINUTES}, {@code HOURS}, {@code HALF_DAYS} and {@code DAYS} are supported. Other {@code ChronoUnit} values will throw an exception. !(p) If the unit is not a {@code ChronoUnit}, then the result of this method is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)} passing {@code this} as the first argument and the converted input temporal as the second argument. !(p) This instance is immutable and unaffected by this method call.
@param endExclusive the end date, exclusive, which is converted to an {@code Instant}, not null @param unit the unit to measure the amount _in, not null @return the amount of time between this instant and the end instant @throws DateTimeException if the amount cannot be calculated, or the end temporal cannot be converted to an {@code Instant} @throws UnsupportedTemporalTypeException if the unit is not supported @throws ArithmeticException if numeric overflow occurs