title: what is wrong with toDateString
body: <p>Following is a script+HTML that tells the user his last visit to page.</p>
  
  <pre><code>&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;Cookie&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  window.onload = initLastVisit;
  
  function initLastVisit() {
  var now = new Date();
  var last = new Date();
  now.setMonth(now.getMonth()+6);
  document.cookie = "lastVisit=" + last.toDateString() + ";path=/;expires=" + now.toGMTString();
  document.getElementById("lastVisitedOn").innerHTML = document.cookie.split("=")[1];
  }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;form&gt;
  &lt;label&gt;Enter your name&amp;nbsp;&amp;nbsp;&lt;input type="text" id="name_field" /&gt;&lt;/label&gt; &lt;br/&gt;
  &lt;/form&gt;
  &lt;h1 id="lastVisitedOn"&gt;&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The statement that sets the cookie in the above script is : <code>document.cookie = "lastVisit=" + last.toDateString() + ";path=/;expires=" + now.toGMTString();</code> . If in this i replace <code>now.toGMTString()</code> with <code>now.toDateString()</code> the expire time in the browser is <strong>"Expires when i close my browser"</strong> . Why is that ?
  It is ok with <code>toGMTString</code> . The expire date is in march 2012 as expected.</p>