Java LocalDate get first day of week for a certain week

Description

Java LocalDate get first day of week for a certain week

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.YearMonth;

public class Main {
  public static void main(String[] argv) {
    DayOfWeek FIRST_DAY_OF_WEEK = DayOfWeek.MONDAY;

    LocalDate f = YearMonth.now().atDay(1).with(FIRST_DAY_OF_WEEK);
    System.out.println(f);/*from   w w w .  j ava 2s .c o  m*/
  }
}



PreviousNext

Related