List of utility methods to do Day of Week
int | dayOfWeek(int dayMark) day Of Week return dayOfWeek(getYearOfDayMark(dayMark), getMonthOfDayMark(dayMark), getDayOfDayMark(dayMark));
|
int | dayOfWeek(int year, int month, int day) Day of week. if (month == 1 || month == 2) { month += 12; year--; return (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7 + 1; |
String | dayOfWeekFromInt(final int theDay) Conversion utility for getting a print friendly string representation of a day of the week from a numeric between 1 and 7. if (theDay > 7 || theDay < 1) { throw new IllegalArgumentException("Argument theDay is not in range of 1 to 7"); switch (theDay) { case 1: return "Sunday"; case 2: return "Monday"; ... |
String | dayOfWeekFromInteger(String aDay, boolean longName) day Of Week From Integer if (aDay == "1") { return longName ? "Sunday" : "Sun"; if (aDay == "2") { return longName ? "Monday" : "Mon"; if (aDay == "3") { return longName ? "Tuesday" : "Tue"; ... |
String[] | dayOfWeekNames() Public method dayOfWeekNames() returns an array of the names for days of a week in the default locale. return dayOfWeekNames;
|
Calendar | endOfWeek(Date inDate, TimeZone timeZone) Calculate the start of the week for the given date. Calendar c1 = Calendar.getInstance(timeZone); c1.setTime(inDate); Calendar c2 = Calendar.getInstance(timeZone); c2.clear(); int daysToAdd = 8 - isoDayOfWeek(c1.get(Calendar.DAY_OF_WEEK)); c2.set(c1.get(Calendar.YEAR), c1.get(Calendar.MONTH), c1.get(Calendar.DAY_OF_MONTH) + daysToAdd); return c2; |
int | extractDayOfWeek(Date date) Extract the day of the week from a Date instance. Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_WEEK);
|
DayOfWeek | findDayOfWeek(String threeLetters) find Day Of Week for (DayOfWeek dow : DayOfWeek.values()) { if (threeLetters.equals(dow.getDisplayName(TextStyle.SHORT, Locale.ENGLISH))) { return dow; return null; |
Date | firstDateAfterAddWeeks(Date early, int weeks) first Date After Add Weeks Date firstDate = getThisweekFirst(early);
firstDate = dayAdd(firstDate, weeks * 7);
return firstDate;
|
TemporalAdjuster | firstDayOfWeek() java.time.temporal.TemporalAdjuster to select the first day of the week from a java.time.OffsetDateTime object. return t -> t.with(DAY_OF_WEEK, 1);
|