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
As the correct Answer by Ray says, you can call with and pass the DayOfWeek enum.
Note that time zone is crucial in determining the date of "today". At any moment the date varies by where you are standing on the globe.
ZoneId zoneId = ZoneId.of ( "America/Montreal" );
LocalDate firstDayOfThisWeek = LocalDate.now ( zoneId ).with ( DayOfWeek.MONDAY );
If you do not specify a time zone, the JVM’s current default time zone is silently applied. Beware: That default can change at any moment during runtime! Better to specify your desired/expected time zone.
ZonedDateTimeYou can apply a time zone (a ZoneId) to your LocalDate to get a ZonedDateTime representing the first moment of the week.
ZonedDateTime thisWeekStart = firstDayOfThisWeek.atStartOfDay ( zoneId );