How to check if a date falls within the next 7 days
<pre><code>function validateDate() {               
    serverDateTime="2012-11-23 17:06:46";
    txtDate.value="30-Nov-2012"

    if (how i check here){
        alert("Appointment can be fixed for next seven days only from current day.");                       
        return false;
    }else{
        return true;
    }
}
</code></pre>

<p>I'm getting serverDateTime on master page load and access that variable in all pages and comparing serverDateTime with txtDate.value how do I validate Appointment can be fixed for next seven days only from current day.</p>

<p>I M USING THIS CODE BUT STILL NOT WORKING </p>

<pre><code>    function validateDate()
            {           
                var dateDifference;
                pickedDate = Date.parse(txtDate.value.replace(/-/g, " "));
                todaysDate = new Date(serverDateTime);
                todaysDate.setHours(0, 0, 0, 0);
                dateDifference = Math.abs(Number(todaysDate) - pickedDate);
                //7 Days=604800000ms
                if (dateDifference &gt; 604800000)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }       
</code></pre>
