YearMonth atEndOfMonth()
returns a LocalDate at the end of the month.
atEndOfMonth
has the following syntax.
public LocalDate atEndOfMonth()
The following example shows how to use atEndOfMonth
.
import java.time.LocalDate; import java.time.YearMonth; // www .ja va 2 s .com 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.