Java Date Time - OffsetTime plus(long amountToAdd, TemporalUnit unit) example








OffsetTime plus(long amountToAdd, TemporalUnit unit) returns a copy of this time with the specified amount added.

Syntax

plus has the following syntax.

public OffsetTime plus(long amountToAdd,   TemporalUnit unit)

Example

The following example shows how to use plus.

import java.time.OffsetTime;
import java.time.temporal.ChronoUnit;
/*from  w w  w . j a v  a 2 s. c  o  m*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime n = m.plus(34,ChronoUnit.DAYS);
    System.out.println(n);

  }
}