Java examples for java.time:Week
get Current Week Day
//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[] getCurrentWeekDay() { return getWeekday(null); }/*from w w w . java2 s . co m*/ public static LocalDate[] getWeekday(LocalDate date) { if (date == null) { date = LocalDate.now(); } 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; } }