Example usage for java.time LocalDate lengthOfYear

List of usage examples for java.time LocalDate lengthOfYear

Introduction

In this page you can find the example usage for java.time LocalDate lengthOfYear.

Prototype

@Override 
public int lengthOfYear() 

Source Link

Document

Returns the length of the year represented by this date.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);

    System.out.println(a.lengthOfYear());
}

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
}