Java LocalDate set to future day

Description

Java LocalDate set to future day

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

public class Main {
  public static void main(String[] args) {
    LocalDate date = LocalDate.now().plusMonths(5).plusDays(4);

    date = date.with(TemporalAdjusters.dayOfWeekInMonth(2, DayOfWeek.FRIDAY));

    System.out.println(date);/*ww w . j a v a  2 s  .com*/

  }
}



PreviousNext

Related