Returns LocalDate date of the first day of month to which provided date belongs to. - Java java.time

Java examples for java.time:Month

Description

Returns LocalDate date of the first day of month to which provided date belongs to.

Demo Code


//package com.java2s;

import java.time.LocalDate;

public class Main {
    /**//from  w ww .jav  a  2s  .c o  m
     * Returns {@link LocalDate} date of the first day of month to which provided {@code date} belongs to.
     */
    public static LocalDate getMonthFirstDay(LocalDate date) {
        return date.withDayOfMonth(1);
    }
}

Related Tutorials