List of utility methods to do Long to Week Convert
boolean | isInNextWeek(long lTime) is In Next Week Calendar calToday = Calendar.getInstance(); Calendar calUnknown = Calendar.getInstance(); calToday.setTimeInMillis(System.currentTimeMillis()); calUnknown.setTimeInMillis(lTime); int nDayOfWeek = calToday.get(Calendar.DAY_OF_WEEK); if (nDayOfWeek == Calendar.SUNDAY) { nDayOfWeek = Calendar.SATURDAY + 1; nDayOfWeek -= 1; calToday.add(Calendar.DAY_OF_YEAR, 8 - nDayOfWeek); if (calUnknown.before(calToday)) { return false; calToday.add(Calendar.DAY_OF_YEAR, 7); if (calUnknown.after(calToday)) { return false; return true; |
boolean | isInLastWeek(long lTime) is In Last Week Calendar calToday = Calendar.getInstance(); Calendar calUnknown = Calendar.getInstance(); calToday.setTimeInMillis(System.currentTimeMillis()); calUnknown.setTimeInMillis(lTime); int nDayOfWeek = calToday.get(Calendar.DAY_OF_WEEK); if (nDayOfWeek == Calendar.SUNDAY) { nDayOfWeek = Calendar.SATURDAY + 1; nDayOfWeek -= 1; calToday.add(Calendar.DAY_OF_YEAR, -(nDayOfWeek - 1)); if (calUnknown.after(calToday)) { return false; calToday.add(Calendar.DAY_OF_YEAR, -7); if (calUnknown.before(calToday)) { return false; return true; |
boolean | isInCurrentWeek(long lTime) is In Current Week Calendar calToday = Calendar.getInstance(); Calendar calUnknown = Calendar.getInstance(); calToday.setTimeInMillis(System.currentTimeMillis()); calUnknown.setTimeInMillis(lTime); int nDayOfWeek = calToday.get(Calendar.DAY_OF_WEEK); if (nDayOfWeek == Calendar.SUNDAY) { nDayOfWeek = Calendar.SATURDAY + 1; nDayOfWeek -= 1; calToday.add(Calendar.DAY_OF_YEAR, -(nDayOfWeek - 1)); if (calUnknown.before(calToday)) { return false; calToday.add(Calendar.DAY_OF_YEAR, 7); if (calUnknown.after(calToday)) { return false; return true; |
boolean | isBeyondNextWeek(long lTime) is Beyond Next Week Calendar calToday = Calendar.getInstance(); Calendar calUnknown = Calendar.getInstance(); calToday.setTimeInMillis(System.currentTimeMillis()); calUnknown.setTimeInMillis(lTime); int nDayOfWeek = calToday.get(Calendar.DAY_OF_WEEK); if (nDayOfWeek == Calendar.SUNDAY) { nDayOfWeek = Calendar.SATURDAY + 1; nDayOfWeek -= 1; calToday.add(Calendar.DAY_OF_YEAR, 8 - nDayOfWeek); if (calUnknown.before(calToday)) { return false; calToday.add(Calendar.DAY_OF_YEAR, 7); if (calUnknown.after(calToday)) { return true; return false; |
long | addWeek(long dateTimeMillis) add Week Calendar calendar = new GregorianCalendar(); calendar.setTimeInMillis(dateTimeMillis); calendar.add(Calendar.DATE, 7); return calendar.getTimeInMillis(); |
long | addWeek(long dateTimeMillis) add Week Calendar calendar = new GregorianCalendar(); calendar.setTimeInMillis(dateTimeMillis); calendar.add(Calendar.DATE, 7); return calendar.getTimeInMillis(); |