title: Javascript Date Function not working
body: <p>I am trying to display the text 'Oct 09, 2012'.  Instead it is not running the function and is displaying a lot of unnessecary date text.  Does anyone know what I am doing wrong?</p>
  
  <p>You can play with my jsfiddle... <a href="http://jsfiddle.net/UP3fd/" rel="nofollow">http://jsfiddle.net/UP3fd/</a></p>
  
  <p>Here is the code...</p>
  
  <pre><code>var myDate = new Date();
  
  convertDate(myDate);
  
  myDate.setFullYear(2012, 9, 9);
  
  document.write(myDate);
  
  function convertDate(d) {
      var day = d.getDate();
      if (day &lt; 10) {
          day = "0" + day;
      }
      var year = d.getFullYear();
      var month = d.getMonth();
      var months=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sep","Oct"," Nov","Dec"];
      var currentMonth = months[month];
      return (currentMonth + " " + day + ", " + year);
  }
  </code></pre>