Java LocalDate set to next Monday

Description

Java LocalDate set to next Monday

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

public class Main {
  public static void main(String[] args) {
    LocalDate ld1 = LocalDate.of(2014, Month.JANUARY, 1);
    LocalDate ld2 = ld1.with(TemporalAdjusters.next(DayOfWeek.MONDAY));
    System.out.println(ld1);//from  w  ww.  j  a v a2s .co  m
    System.out.println(ld2);
  }
}



PreviousNext

Related