Java Data Type How to - Adjust LocalDate to first Day Of Month


We would like to know how to adjust LocalDate to first Day Of Month.


import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.TemporalAdjusters;
//from   w  w  w .  jav a  2 s  . c  o  m
public class Main {
  public static void main(String[] args) {
    LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25

    // first day of February 2014 (2014-02-01)
    LocalDate firstDayOfMonth = date.with(TemporalAdjusters.firstDayOfMonth());


The code above generates the following result.