Java TemporalAdjuster create

Description

Java TemporalAdjuster create

import java.time.LocalDate;
import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAdjusters;

public class Main {
  public static void main(String[] args) {
    TemporalAdjuster adjuster = /*from w  ww.ja  v a  2s .c  om*/
       TemporalAdjusters.ofDateAdjuster((LocalDate date) -> date.plusMonths(2).plusDays(42));

    LocalDate today = LocalDate.now();
    LocalDate a = today.with(adjuster);
    System.out.println("Today: " + today);
    System.out.println("new  : " + a);
    

  }
}



PreviousNext

Related