Java Date Time Java Java API
java.time.LocalDate
public int lengthOfMonth()
This method returns the number of days in the month corresponding to this local date.
package com.logicbig.example.localdate;import java.time.LocalDate;public class LengthOfMonthExample { public static void main (String... args) { LocalDate d = LocalDate.of(1998, 5, 3) .plusDays(400); System.out.println(d.lengthOfMonth()); System.out.println(d.getMonth()); }}
30JUNE