Android Utililty Methods Week Compare

List of utility methods to do Week Compare

Description

The list of methods to do Week Compare are organized into topic(s).

Method

booleanisSameWeek(Time t1, Time t2)
is Same Week
if (isSameDate(t1, t2)) {
    return true;
final Time x;
final Time y;
if (t1.before(t2)) {
    x = t1;
    y = t2;
...
booleanisWithinTheWeek(Date sunday, Date now)
is Within The Week
long sun = sunday.getTime();
long today = now.getTime();
if (today >= sun && today <= sun + WEEK_IN_MILLISECONDS) {
    return true;
return false;
booleanisSameWeek(Date date)
is Same Week
Calendar beginningOfTheWeek = Calendar.getInstance();
beginningOfTheWeek.set(Calendar.DAY_OF_WEEK,
        beginningOfTheWeek.getFirstDayOfWeek());
beginningOfTheWeek.set(Calendar.HOUR, 0);
beginningOfTheWeek.set(Calendar.MINUTE, 0);
Calendar endOfTheWeek = Calendar.getInstance();
endOfTheWeek.set(Calendar.DAY_OF_WEEK,
        endOfTheWeek.getFirstDayOfWeek());
...