List of utility methods to do Week Get
Date | getDateAWeekAgo(Date date) get Date A Week Ago Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.DAY_OF_MONTH, -7);
Date ret = c.getTime();
return ret;
|
Date | getDateInAWeek(Date date) get Date In A Week Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.DAY_OF_MONTH, 7);
Date ret = c.getTime();
return ret;
|
int | getWeeksSinceEpochFromJulianDay(int julianDay, int firstDayOfWeek) Returns the week since Time#EPOCH_JULIAN_DAY (Jan 1, 1970) adjusted for first day of week. int diff = Time.THURSDAY - firstDayOfWeek; if (diff < 0) { diff += 7; int refDay = Time.EPOCH_JULIAN_DAY - diff; return (julianDay - refDay) / 7; |
void | getStartAndEndDatesForWeek(Calendar currentDate, Calendar startDate, Calendar endDate) get Start And End Dates For Week Calendar cal = (Calendar) currentDate.clone(); int i = 0; while (i < 8 && Calendar.SUNDAY != cal.get(Calendar.DAY_OF_WEEK)) { cal.add(Calendar.DAY_OF_MONTH, -1); i++; if (i == 0) { cal.add(Calendar.DAY_OF_MONTH, -1); ... |
String[] | getDaysOfWeekNames() get Days Of Week Names return getDaysOfWeekNames(Locale.getDefault(), LONG);
|
String[] | getDaysOfWeekNames(Locale l, int len) get Days Of Week Names String[] s; if (len == SHORT) s = new DateFormatSymbols(l).getShortWeekdays(); else s = new DateFormatSymbols(l).getWeekdays(); int firstDay = Calendar.getInstance().getFirstDayOfWeek(); if (firstDay != 1) { String[] buf = new String[8]; ... |
char | getEnglishDayInWeek(Date date) Returns the first letter of day in week. Calendar c = Calendar.getInstance(); c.setTime(date); int dayInWeek = c.get(Calendar.DAY_OF_WEEK); switch (dayInWeek) { case Calendar.MONDAY: return 'M'; case Calendar.TUESDAY: return 'T'; ... |
int | getFirstDayOfFirstWeekOfMonth(final Calendar cal) get First Day Of First Week Of Month Calendar c = (Calendar) cal.clone();
c.set(DAY_OF_MONTH, 1);
return c.get(DAY_OF_WEEK);
|