Close

Java Date Time - YearMonth.atEndOfMonth() Examples

Java Date Time Java Java API 


Class:

java.time.YearMonth

java.lang.Objectjava.lang.Objectjava.time.YearMonthjava.time.YearMonthjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Method:

public LocalDate atEndOfMonth()

Returns a LocalDate having same month and year fields of this YearMonth object, but date set to the end of month.


Examples


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);
}
}

Output

2010-11
2010-11-30




See Also