OffsetTime until(Temporal endExclusive, TemporalUnit unit) example
Description
OffsetTime until(Temporal endExclusive, TemporalUnit unit)
calculates the amount of time until another time in terms of the specified unit.
Syntax
until
has the following syntax.
public long until(Temporal endExclusive, TemporalUnit unit)
Example
The following example shows how to use until
.
import java.time.OffsetTime;
import java.time.temporal.ChronoUnit;
/*from ww w . j a va 2 s . co m*/
public class Main {
public static void main(String[] args) {
OffsetTime m = OffsetTime.now();
long n = m.until(OffsetTime.now(),ChronoUnit.MINUTES);
System.out.println(n);
}
}
The code above generates the following result.