get the last day of a month in java

www.lautt‮moc.iru‬
get the last day of a month in java
/**
 * @author lautturi.com
 * Java example: Get the last day of a month in Java
 */

import java.util.*;
import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;

public class Lautturi {

	@SuppressWarnings("deprecation")
	public static void main(String[] args) {

		LocalDate now = LocalDate.now();

		LocalDate lastDay = now.with(TemporalAdjusters.lastDayOfMonth());

		System.out.println("The last day of month:" + lastDay);
	}
}

output :

The last day of month:2020-11-30
Created Time:2017-09-07 12:53:58  Author:lautturi