Get the first day of the current month in Java

www.lau‮c.irutt‬om
Get the first day of the current month in Java
/**
 * @author lautturi.com
 * Java example: java get the first day of the current month
 */

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 firstDay = now.with(TemporalAdjusters.firstDayOfMonth());

		System.out.println("The first day of month:" + firstDay);
	}
}

output :

The first day of month:2020-11-01
Created Time:2017-09-07 11:48:44  Author:lautturi