List of utility methods to do Day of Week
int | getWeekday(Date d) determines the day of the week if (d == null) { return -1; Calendar cal = Calendar.getInstance(); cal.setTime(d); int w = cal.get(Calendar.DAY_OF_WEEK); return w; |
int | getWeekDay(Date d) get Week Day if (d == null) return -1; final Calendar c = new GregorianCalendar(); c.setTime(d); return c.get(Calendar.DAY_OF_WEEK) - 1; |
int | getWeekDay(Date date) Get the week day of the specified date. GregorianCalendar cal = getCalender(date, false);
return cal.get(Calendar.DAY_OF_WEEK);
|
String | getWeekDay(Date date) get Week Day Calendar cal = Calendar.getInstance(); cal.setTime(date); int idx = cal.get(Calendar.DAY_OF_WEEK) - 1; return WEEK_DAYS[idx]; |
int | getWeekDay(Date date) get Week Day GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); return cal.get(Calendar.DAY_OF_WEEK); |
int | getWeekDay(Date date) Return week day of specified date Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DAY_OF_WEEK);
|
Date | getWeekDay(Date dt, int weekDay) get Week Day Calendar cal = new GregorianCalendar(); cal.setTime(dt); if (weekDay == 7) weekDay = 1; else weekDay++; cal.set(GregorianCalendar.DAY_OF_WEEK, weekDay); return cal.getTime(); ... |
int | getWeekDay(String strDate) get Week Day Calendar cal = parseDateTime(strDate);
return cal.get(Calendar.DAY_OF_WEEK);
|
Date | getWeekdayDate(Date actualDate) get Weekday Date final Calendar calendar = Calendar.getInstance(); calendar.setTime(actualDate); calendar.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); final Date newDate = calendar.getTime(); if (newDate.before(actualDate)) { calendar.add(Calendar.WEEK_OF_YEAR, Calendar.SATURDAY); return calendar.getTime(); ... |
int | getWeekdayInterval(Date date) get Weekday Interval List<String> holidays = Arrays.asList(Holidays); Calendar now = Calendar.getInstance(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int d = (int) ((now.getTimeInMillis() - calendar.getTimeInMillis()) / (24 * 60 * 60 * 1000)); int n = 0; for (int i = 0; i < d; i++) { calendar.add(Calendar.DATE, 1); ... |