LocalDate lengthOfMonth() example
Description
LocalDate lengthOfMonth()
returns the length of the month represented by this date.
This returns the length of the month in days. For example, a date in January would return 31.
Syntax
lengthOfMonth
has the following syntax.
public int lengthOfMonth()
Example
The following example shows how to use lengthOfMonth
.
import java.time.LocalDate;
// ww w .ja v a2 s . co m
public class Main {
public static void main(String[] args) {
LocalDate a = LocalDate.of(2014, 6, 30);
System.out.println(a.lengthOfMonth());
}
}
The code above generates the following result.