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








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

Syntax

plus has the following syntax.

public LocalDate plus(long amountToAdd,  TemporalUnit unit)

Example

The following example shows how to use plus.

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
/*from w  w w.ja v  a 2 s . co m*/
public class Main {
  public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    LocalDate b = a.plus(100,ChronoUnit.DAYS);
    System.out.println(b);
  }
}

The code above generates the following result.