Example usage for java.time.temporal TemporalAdjusters ofDateAdjuster

List of usage examples for java.time.temporal TemporalAdjusters ofDateAdjuster

Introduction

In this page you can find the example usage for java.time.temporal TemporalAdjusters ofDateAdjuster.

Prototype

public static TemporalAdjuster ofDateAdjuster(UnaryOperator<LocalDate> dateBasedAdjuster) 

Source Link

Document

Obtains a TemporalAdjuster that wraps a date adjuster.

Usage

From source file:Main.java

public static void main(String[] args) {
    // Create an adjuster that retruns a date after 3 months and 2 days
    TemporalAdjuster adjuster = TemporalAdjusters
            .ofDateAdjuster((LocalDate date) -> date.plusMonths(3).plusDays(2));

    LocalDate today = LocalDate.now();
    LocalDate dayAfter3Mon2Day = today.with(adjuster);
    System.out.println("Today: " + today);
    System.out.println("After 3  months  and  2  days: " + dayAfter3Mon2Day);

}