Java examples for java.time:Week
Returns LocalDate date of the Monday of week to which provided date belongs to.
//package com.java2s; import java.time.DayOfWeek; import java.time.LocalDate; public class Main { /**/* w w w . j a v a2s. com*/ * Returns {@link LocalDate} date of the Monday of week to which provided {@code date} belongs to. */ public static LocalDate getWeekStart(LocalDate date) { int daysToMonday = date.getDayOfWeek().getValue() - DayOfWeek.MONDAY.getValue(); return date.minusDays(daysToMonday); } }