YearMonth atEndOfMonth() example
Description
YearMonth atEndOfMonth()
returns a LocalDate at the end of the month.
Syntax
atEndOfMonth
has the following syntax.
public LocalDate atEndOfMonth()
Example
The following example shows how to use atEndOfMonth
.
import java.time.LocalDate;
import java.time.YearMonth;
/* www . jav a2 s. c o m*/
public class Main {
public static void main(String[] args) {
YearMonth y = YearMonth.now();
LocalDate l = y.atEndOfMonth();
System.out.println(l);
}
}
The code above generates the following result.