Example usage for java.time Year minusYears

List of usage examples for java.time Year minusYears

Introduction

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

Prototype

public Year minusYears(long yearsToSubtract) 

Source Link

Document

Returns a copy of this Year with the specified number of years subtracted.

Usage

From source file:Main.java

public static void main(String[] args) {
    Year y = Year.of(2014);
    Year l = y.minusYears(12);
    System.out.println(l);//from   w w  w .ja v a  2 s  . co m

}

From source file:Main.java

public static void main(String[] args) {
    Year y1 = Year.of(2014);
    System.out.println(y1);/*w w w . j a  v a2s.co m*/
    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.");
    }

}