LocalDate with(TemporalAdjuster adjuster) example
Description
LocalDate with(TemporalAdjuster adjuster)
returns an adjusted copy of this date.
Syntax
with
has the following syntax.
public LocalDate with(TemporalAdjuster adjuster)
Example
The following example shows how to use with
.
import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;
//from ww w. j a v a 2 s . c o m
public class Main {
public static void main(String[] args) {
LocalDate a = LocalDate.of(2014, 6, 30);
LocalDate b = a.with(TemporalAdjusters.firstDayOfMonth());
System.out.println(b);
}
}
The code above generates the following result.