Java examples for java.time:Week
get Weekday
//package com.java2s; import java.time.DayOfWeek; import java.time.LocalDate; public class Main { public static final int DAYS_OF_WEEK = 7; public static LocalDate[] getWeekday(LocalDate date) { if (date == null) { date = LocalDate.now(); }// w w w . j av a 2 s . c o m LocalDate begin = null; if (date.getDayOfWeek().equals(DayOfWeek.SUNDAY)) { begin = date; } else { begin = date.minusDays(date.getDayOfWeek().getValue()); } LocalDate end = begin.plusDays(DAYS_OF_WEEK - 1); LocalDate localDate[] = { begin, end }; return localDate; } }