title: new Date() and split() cross-browser compatibility
body: <p>I'm trying to make a date to appear as <code>Fri, Feb 17 2012</code> instead of <code>Friday, February 17, 2012</code></p>
  
  <p>Here is my code:</p>
  
  <pre><code>     var n = new Date(),
          ampm = 'am',
          h = n.getHours(),
          m = n.getMinutes(),
          s = n.getSeconds();
       if (h &gt;= 12) {
          if (h &gt; 12) h -= 12;
          ampm = 'pm'
       }
       if (h &lt; 10) h = '0' + h;
       if (m &lt; 10) m = '0' + m;
       t = n.toLocaleDateString();
       var d = 
           t.split(',')[0].substring(0, 3)
           + ', '
           + t.split(',')[1].substring(1, 4)
           + ' '
           + t.split(',')[1].split(' ')[2]
           + t.split(',')[2]
           + ', '
           + ' '
           + h + ':' + m + ' ' + ampm;
       var e = Math.round((new Date() - new Date('2012/01/01').getTime()) / 1000);
       var f = [1];
       var a = [];
       var i = 0;
       alert(d);​
  </code></pre>
  
  <p>Now this works on some browsers but it doesnt on others. Some browsers show 17, 201, undefinedundefined, and some  browsers show what I am looking for.</p>
  
  <p>Can anyone spot what I am missing? </p>
  
  <p>Fiddle: <a href="http://jsfiddle.net/nxyum/" rel="nofollow">http://jsfiddle.net/nxyum/</a></p>
  
  <p>Works on:</p>
  
  <pre><code>Windows: Chrome, Safari
  Mac: Chrome, Opera
  </code></pre>
  
  <p>​</p>
  
  <p>Doesn't work:</p>
  
  <pre><code>Windows: Firefox, Opera, IE
  Mac: Firefox, Safari
  </code></pre>