Java Date Time Java Java API
java.time.YearMonth
public LocalDate atEndOfMonth()
Returns a LocalDate having same month and year fields of this YearMonth object, but date set to the end of month.
LocalDate
package com.logicbig.example.yearmonth;import java.time.LocalDate;import java.time.YearMonth;public class AtEndOfMonthExample { public static void main(String... args) { YearMonth y = YearMonth.of(2010, 11); System.out.println(y); LocalDate d = y.atEndOfMonth(); System.out.println(d); }}
2010-112010-11-30