Example usage for java.time Period negated

List of usage examples for java.time Period negated

Introduction

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

Prototype

public Period negated() 

Source Link

Document

Returns a new instance with each amount in this period negated.

Usage

From source file:Main.java

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

    Period l = p.negated();
    System.out.println(l);/*  w  ww.  java 2  s .  co  m*/

}

From source file:Main.java

public static void main(String[] args) {
    Period p1 = Period.ofDays(15);
    System.out.println(p1);// ww  w  .  j  a  v a 2  s  .  c  o  m
    Period p2 = p1.plusDays(12);
    System.out.println(p2);
    Period p3 = p1.minusDays(12);
    System.out.println(p3);
    Period p4 = p1.negated();
    System.out.println(p4);
    Period p5 = p1.multipliedBy(3);
    System.out.println(p5);
}