Android Week Compare isWithinTheWeek(Date sunday, Date now)

Here you can find the source of isWithinTheWeek(Date sunday, Date now)

Description

is Within The Week

Declaration

public static boolean isWithinTheWeek(Date sunday, Date now) 

Method Source Code

//package com.java2s;

import java.util.Date;

public class Main {
    public static final int WEEK_IN_MILLISECONDS = 604800000;

    public static boolean isWithinTheWeek(Date sunday, Date now) {
        long sun = sunday.getTime();
        long today = now.getTime();

        if (today >= sun && today <= sun + WEEK_IN_MILLISECONDS) {
            return true;
        }// w  ww . j  av  a2 s  .co  m

        return false;
    }
}

Related

  1. isSameWeek(Time t1, Time t2)
  2. isSameWeek(Date date)