Example usage for java.time.temporal UnsupportedTemporalTypeException printStackTrace

List of usage examples for java.time.temporal UnsupportedTemporalTypeException printStackTrace

Introduction

In this page you can find the example usage for java.time.temporal UnsupportedTemporalTypeException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalTime localTime = LocalTime.of(11, 20, 50);
    System.out.println(localTime.plus(3, ChronoUnit.HOURS));
    System.out.println(localTime.plus(Duration.ofDays(3))); //11:20:50
    try {/*from   ww w . j a v a  2 s .c  o  m*/
        System.out.println(localTime.plus(Period.ofDays(3)));
    } catch (UnsupportedTemporalTypeException e) {
        e.printStackTrace();
    }

}

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 {//from w w  w  . ja v a  2  s .co m
        System.out.println(localDate.plus(Duration.ofDays(3)));

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