/**
* @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