Example usage for java.time Period ofDays

List of usage examples for java.time Period ofDays

Introduction

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

Prototype

public static Period ofDays(int days) 

Source Link

Document

Obtains a Period representing a number of days.

Usage

From source file:Main.java

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

    System.out.println(p.equals(Period.ZERO));

}

From source file:Main.java

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

    System.out.println(p.toString());

}

From source file:Main.java

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

    System.out.println(p.hashCode());

}

From source file:Main.java

public static void main(String[] args) {

    Period p = Period.ofDays(12);

    System.out.println(p.toString());

}

From source file:Main.java

public static void main(String[] args) {
    Period p1 = Period.ofDays(15);
    System.out.println(p1);//from  ww w. j av a2 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);
}

From source file:Main.java

public static void main(String[] args) {
    Period p = Period.ofDays(30);
    System.out.println(p);/*from  w w  w  . j ava2s  . co  m*/

    Period p1 = Period.ofMonths(12);
    System.out.println(p1);

    Period p2 = Period.ofWeeks(11);
    System.out.println(p2);

    Period p3 = Period.ofYears(50); // years, months, days
    System.out.println(p3);
}

From source file:Main.java

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

    Temporal l = p.subtractFrom(LocalDate.now());
    System.out.println(l);/*w ww . ja v  a  2 s . co m*/

}

From source file:Main.java

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

    Temporal l = p.addTo(LocalDate.now());
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    LocalTime l = LocalTime.now();
    LocalTime s = l.minus(Period.ofDays(1));
    System.out.println(s);
}

From source file:Main.java

public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime n = m.plus(Period.ofDays(12));
    System.out.println(n);/*from   w w  w .  j  ava2s  .c  o m*/

}