title: javascript Date().getTime() is not a function
body: <p>I'm trying to compare some Dates in javascript.</p>
  
  <p>For some reason, I'm getting "Tue May 01 2012 16:43:03 GMT+0900 (JST) has no method 'getTime'"</p>
  
  <p>Of course, <a href="https://stackoverflow.com/questions/2627650/why-javascript-gettime-is-not-a-function">strings don't have methods</a></p>
  
  <p>I started with this code inside a callback, but it was failing at <code>getTime()</code> on the line that creates <code>var age</code>:</p>
  
  <pre><code>for (var i = 0; i &lt; array_of_usage_indices.length; i++) {
      store.get(array_of_usage_indices[i]['key'],function(may_need_gc) {
          if(may_need_gc) {
              var now = Date();
              var created = Date(may_need_gc['value']);
              var age = now.getTime()-created.getTime();
          }
      })
  }
  </code></pre>
  
  <p>I've pared it down so my example page is literally just this:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
          &lt;title&gt;date test&lt;/title&gt;
  
      &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;script type="text/javascript" charset="utf-8"&gt;
              var now = Date();
              alert(now.getTime());
              var t = Date().getTime();
  &lt;/script&gt;    
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is failing in Chrome 18.0.1025.168 and Firefox 13.0.</p>
  
  <p>Screenshots of what I've tried:</p>
  
  <p><img src="https://i.stack.imgur.com/iQlLH.png" alt="screenshot no method &#39;getTime&#39;"></p>
  
  <p><img src="https://i.stack.imgur.com/2fKo8.png" alt="screenshot no method &#39;getTime&#39;"></p>
  
  <p>So my question:</p>
  
  <p><strike>wth?</strike></p>
  
  <p>Do I have to use ParseDate()?  Why isn't this working?</p>