Example usage for java.time Period minus

List of usage examples for java.time Period minus

Introduction

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

Prototype

public Period minus(TemporalAmount amountToSubtract) 

Source Link

Document

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

Usage

From source file:Main.java

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

    Period l = p.minus(Period.ofMonths(1));
    System.out.println(l);/*w ww. ja  va2s .  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);// www.  j a va2s . co m
    System.out.println(p2);
    System.out.println(p1.minus(p2));
    System.out.println(p1.plus(p2));
    System.out.println(p1.plus(p2).normalized());
}