Example usage for java.time Year isLeap

List of usage examples for java.time Year isLeap

Introduction

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

Prototype

public boolean isLeap() 

Source Link

Document

Checks if the year is a leap year, according to the ISO proleptic calendar system rules.

Usage

From source file:Main.java

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

    System.out.println(y.isLeap());

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate date = LocalDate.of(2014, 2, 15); // 2014-02-15
    System.out.println(date.getYear()); // 2014
    System.out.println(date.getDayOfYear()); // 46
    System.out.println(date.lengthOfYear()); // 365
    System.out.println(date.isLeapYear()); // false

    Year year_2014 = Year.of(2014);
    System.out.println(year_2014.isLeap()); // false
}

From source file:Main.java

public static void main(String[] args) {
    Year currentYear = Year.now();
    Year twoThousand = Year.of(2000);
    boolean isLeap = currentYear.isLeap(); // false
    int length = currentYear.length(); // 365

    // sixtyFourth day of 2014 (2014-03-05)
    LocalDate date = Year.of(2014).atDay(64);

    System.out.println("year: currentYear: " + currentYear);
    System.out.println("year: twoThousand: " + twoThousand);
    System.out.println("year: isLeap: " + isLeap);
    System.out.println("year: length: " + length);
    System.out.println("year: date: " + date);
}

From source file:Main.java

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

}