Get date of first day of week based on LocalDate.now() in Java 8

前端 未结 9 1502
梦谈多话
梦谈多话 2020-12-02 19:35

I would like the get the date of the first day of the week based on LocalDate.now(). The following was possible with JodaTime, but seems to be removed from the new Date API

9条回答
  •  春和景丽
    2020-12-02 20:30

    It works for me in case if I want to get Monday as a first day of current week:

    LocalDate mondayDate = LocalDate.now().with(WeekFields.of(Locale.FRANCE).getFirstDayOfWeek());
    

提交回复
热议问题