Example usage for java.time.temporal ChronoUnit YEARS

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

Introduction

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

Prototype

ChronoUnit YEARS

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

Click Source Link

Document

Unit that represents the concept of a year.

Usage

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    Year l = y.plus(2, ChronoUnit.YEARS);
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    long l = y.until(Year.of(2000), ChronoUnit.YEARS);
    System.out.println(l);/*from   w w  w.  ja v  a2  s. co  m*/

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);

    System.out.println(y.isSupported(ChronoUnit.YEARS));

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.plus(3, ChronoUnit.YEARS);
    System.out.println(s);/*w  w w .j a  v a 2 s  . c om*/

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    boolean m = y.isSupported(ChronoUnit.YEARS);
    System.out.println(m);/*from w w w . java 2  s .c om*/

}

From source file:Main.java

public static void main(String[] args) {
    YearMonth y = YearMonth.now();
    YearMonth s = y.minus(12, ChronoUnit.YEARS);
    System.out.println(s);//from  www  . jav a  2  s.c  o  m

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    LocalDate b = a.minus(6, ChronoUnit.YEARS);
    System.out.println(b);/* ww w.  j  a va2 s .c  o m*/
}

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime dateTime = ZonedDateTime.now();
    ZonedDateTime n = dateTime.plus(12, ChronoUnit.YEARS);
    System.out.println(n);//w  w  w.java  2 s.c  o m
}

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime dateTime = ZonedDateTime.now();
    ZonedDateTime n = dateTime.truncatedTo(ChronoUnit.YEARS);
    System.out.println(n);/*from   ww  w . j a v  a 2s .c  o m*/
}

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime dateTime = ZonedDateTime.now();

    System.out.println(dateTime.isSupported(ChronoUnit.YEARS));
}