title: Why does getDay return incorrect values? (javascript)
body: <p>I tried to get the day of a week with the <code>getDay()</code> function of the <code>Date</code> object in Javascript. 
  In theory it works fine, but sometimes there is a delay in the output, so if the function should return a "4", it returns a "1".</p>
  
  <p>E.g.</p>
  
  <pre><code>var date= new Date("2009","04","30");
  alert(date.getDay()); // the function returns 6, should return 4
  
  var date= new Date("2009","05","01");
  alert(date.getDay()); // the function returns 1, should return 5
  </code></pre>
  
  <p>I really don't know why this happens. This example comes from IE8. FF 3 behaves similar, but returns different values. The first one is 7, not 4. The second one is just like in IE8.</p>
  
  <p>Any ideas why this happens?</p>