Java Date Time - OffsetTime plus(TemporalAmount amountToAdd) example








OffsetTime plus(TemporalAmount amountToAdd) returns a copy of this time with the specified amount added.

Syntax

plus has the following syntax.

public OffsetTime plus(TemporalAmount amountToAdd)

Example

The following example shows how to use plus.

import java.time.OffsetTime;
import java.time.Period;
//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(Period.ofDays(12));
    System.out.println(n);

  }
}