check if the date is earlier than today
<pre><code>   alert(date2);//Sat Oct 29 0112 00:00:00 GMT+0100 (GMT Daylight Time) 
   alert(date1);//Fri Oct 12 2012 00:00:00 GMT+0100 (GMT Daylight Time)

if (date1.getTime()&lt;date2.getTime()) {
     alert('your date can not be earlier than today.');
}
</code></pre>

<p>My question is why i don't see the alert? There is something wrong?</p>

<p>edit:</p>

<pre><code>var today = new Date();
date2 = new Date(today.getYear(), today.getMonth(), today.getDate());
</code></pre>

<p>why this show the year as 0112??</p>
