java get day of week code example
Example 1: get day of week java
public static String getDayStringNew(LocalDate date, Locale locale) {
DayOfWeek day = date.getDayOfWeek();
return day.getDisplayName(TextStyle.FULL, locale);
}
Example 2: java get first day of the week
private static Date firstDayOfWeek(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_WEEK, 1);
return calendar.getTime();
}