Example usage for java.time OffsetDateTime until

List of usage examples for java.time OffsetDateTime until

Introduction

In this page you can find the example usage for java.time OffsetDateTime until.

Prototype

@Override
public long until(Temporal endExclusive, TemporalUnit unit) 

Source Link

Document

Calculates the amount of time until another date-time in terms of the specified unit.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    long d = o.until(OffsetDateTime.now(ZoneId.systemDefault()), ChronoUnit.WEEKS);
    System.out.println(d);//  ww  w  .j a  va  2 s  . co m
}