List of utility methods to do Day of Week
int | getWeekNumOfYear(Date date) get Week Num Of Year Calendar c = new GregorianCalendar(); c.setFirstDayOfWeek(Calendar.MONDAY); c.setMinimalDaysInFirstWeek(7); c.setTime(date); return c.get(Calendar.WEEK_OF_YEAR); |
String | getWeekOfDate(Date dt) get Week Of Date String[] weekDays = { "7", "1", "2", "3", "4", "5", "6" }; Calendar cal = Calendar.getInstance(); cal.setTime(dt); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w < 0) w = 0; return weekDays[w]; |
int | getWeekOfDay(Date date) get Week Of Day Calendar cal = Calendar.getInstance(); cal.setTime(date); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w == 0) { w = Calendar.DAY_OF_WEEK; } else if (w < 0) { w = 0; return w; |
int | getWeekOfMonth(Date date) get Week Of Month Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(Calendar.WEEK_OF_MONTH);
|
int | getWeekOfMonth(final Date date) Get the week of the month by given date. return getNumberOfGranularity(Calendar.WEEK_OF_MONTH, date);
|
Integer | getWeekOfMonthFirstDay(Date dt) get Week Of Month First Day Calendar cal = Calendar.getInstance();
cal.set(dt.getYear() + 1900, dt.getMonth(), 1);
return cal.get(Calendar.DAY_OF_WEEK) - 1;
|
int | getWeekOfTheYear(Date aDate) Week number of the date. Calendar cal = Calendar.getInstance();
cal.setTime(aDate);
return cal.get(Calendar.WEEK_OF_YEAR);
|
int | getWeekOfTheYear(final Date dateOfYear) Returns the numerical week of the year given a date. final GregorianCalendar c = gregorianCalendarThreadLocal.get(); int minimal = c.getMinimalDaysInFirstWeek(); c.setTime(dateOfYear); c.setMinimalDaysInFirstWeek(4); int returnVal = c.get(Calendar.WEEK_OF_YEAR); c.setMinimalDaysInFirstWeek(minimal); return returnVal; |
int | getWeekOfYear(Date d, Locale locale) get Week Of Year Calendar c = Calendar.getInstance(getSafeLocale(locale));
c.setTime(d);
return c.get(Calendar.WEEK_OF_YEAR);
|
int | getWeekOfYear(Date date) The week of the year as an int from the given Date-object. final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.WEEK_OF_YEAR); |