Example usage for java.time Year of

List of usage examples for java.time Year of

Introduction

In this page you can find the example usage for java.time Year of.

Prototype

public static Year of(int isoYear) 

Source Link

Document

Obtains an instance of Year .

Usage

From source file:Main.java

public static void main(String[] args) {

    Year y = Year.of(2014);

    System.out.println(y.isAfter(Year.of(2015)));

}

From source file:Main.java

public static void main(String[] args) {

    Year y = Year.of(2014);

    System.out.println(y.compareTo(Year.of(2015)));

}

From source file:Main.java

public static void main(String[] args) {
    Year y1 = Year.of(2014);
    System.out.println(y1);/*from   w  ww  .jav  a  2 s.com*/
    Year y2 = y1.minusYears(1);
    System.out.println(y2);
    Year y3 = y1.plusYears(1);
    System.out.println(y3);
    Year y4 = Year.now();
    System.out.println(y4);
    if (y1.isLeap()) {
        System.out.println(y1 + "  is a  leap year.");
    } else {
        System.out.println(y1 + "  is not  a  leap year.");
    }

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    Year l = y.minus(Period.ofYears(12));
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    Year l = y.plus(Period.ofYears(12));
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    LocalDate l = y.atDay(123);
    System.out.println(l);

}

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    Temporal l = y.adjustInto(Year.of(2000));
    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.  j a va 2s.c  o  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) {
    Year y = Year.of(2014);
    Year l = y.minus(12, ChronoUnit.WEEKS);
    System.out.println(l);

}