Example usage for java.time.temporal ChronoUnit FOREVER

List of usage examples for java.time.temporal ChronoUnit FOREVER

Introduction

In this page you can find the example usage for java.time.temporal ChronoUnit FOREVER.

Prototype

ChronoUnit FOREVER

To view the source code for java.time.temporal ChronoUnit FOREVER.

Click Source Link

Document

Artificial unit that represents the concept of forever.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2012, 11, 23);
    System.out.println(localDate.plus(3, ChronoUnit.DAYS)); //2012-11-26

    System.out.println(localDate.plus(Period.ofDays(3))); //2012-11-26
    try {// w w w. j a  v  a 2  s .c o  m
        System.out.println(localDate.plus(Duration.ofDays(3)));

        System.out.println(localDate.plus(4, ChronoUnit.FOREVER));
    } catch (UnsupportedTemporalTypeException e) {
        e.printStackTrace();
    }
}