List of utility methods to do Week Day
int | getDayWithWeek(Date date) get Day With Week int day = getNumberFromDate(date, Calendar.DAY_OF_WEEK); if (day == 1) { return 7; return day - 1; |
String | getENWeekDay() get EN Week Day Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w < 0) w = 0; return WEEKDAYS_EN[w]; |
List | getFirstday_Lastday_Week() get Firstda Lastda Week SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar calendar = Calendar.getInstance(); int w = calendar.get(Calendar.DAY_OF_WEEK); calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - w); String day_last = df.format(calendar.getTime()); StringBuffer str = new StringBuffer().append(day_last).append(" 23:59:59"); day_last = str.toString(); ... |
Date | getFirstDayOfLastWeek(Date date) get First Day Of Last Week Calendar c = Calendar.getInstance();
c.setTimeInMillis(date.getTime() - 604800000L);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
Date lastWeekDate = c.getTime();
c = new GregorianCalendar();
c.setFirstDayOfWeek(Calendar.MONDAY);
...
|
int | getFirstDayOfWeek() get First Day Of Week return firstDayOfWeek;
|
int | getFirstDayOfWeek() Retrieve the first day of the week using the systems default locale. if (_firstDayofWeek != -1) { return _firstDayofWeek; Calendar cal = Calendar.getInstance(); _firstDayofWeek = cal.getFirstDayOfWeek(); return _firstDayofWeek; |
Date | getFirstDayOfWeek(Date date) get First Day Of Week Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return getADayOfWeek(calendar, Calendar.MONDAY).getTime();
|
Date | getFirstDayOfWeek(Date date) get First Day Of Week Calendar c = new GregorianCalendar(); c.setFirstDayOfWeek(Calendar.SUNDAY); c.setTime(date); c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek()); return c.getTime(); |
Date | getFirstDayOfWeek(final Date date) get First Day Of Week if (dayOfWeek(date) == 1) { return addDays(date, -6); return addDays(date, -1 * (dayOfWeek(date) - 2)); |
String | getFirstDayOfWeek(String format) get First Day Of Week return getDayOfWeek(format, Calendar.MONDAY);
|