Example usage for java.time Period plus

List of usage examples for java.time Period plus

Introduction

In this page you can find the example usage for java.time Period plus.

Prototype

public Period plus(TemporalAmount amountToAdd) 

Source Link

Document

Returns a copy of this period with the specified period added.

Usage

From source file:Main.java

public static void main(String[] args) {
    Period p = Period.ofMonths(1);

    Period l = p.plus(Period.ofMonths(1));
    System.out.println(l);/*from  w w  w . j  av a  2  s  .  c  o m*/

}

From source file:Main.java

public static void main(String[] args) {
    Period p1 = Period.of(2, 3, 5);
    Period p2 = Period.of(1, 15, 28);
    System.out.println(p1);//from  ww w . j  a  v a 2s.c  o  m
    System.out.println(p2);
    System.out.println(p1.minus(p2));
    System.out.println(p1.plus(p2));
    System.out.println(p1.plus(p2).normalized());
}