Javascript: Replace Date's full day name and full month name with 3 letters. Tuesday > Tue
<p>I have a simple snippet which prints full day, month, day of month, hour and minute.</p>

<p>Here is the code:
<a href="http://jsfiddle.net/raNms/" rel="nofollow">http://jsfiddle.net/raNms/</a></p>

<p>I want to change where</p>

<pre><code>Monday &gt; Mon
Tuesday &gt; Tue
...
</code></pre>

<p>and months:</p>

<pre><code>January &gt; Jan
February &gt; Feb
...
</code></pre>

<p>Can it be done before appending to body? I don't want to replace the appended text but to print it correctly from the beginning.</p>

<p>The JavaScript:</p>

<pre><code>var now= new Date(),
    ampm= 'am',
    h= now.getHours(),
    m= now.getMinutes(),
    s= now.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;
    var time = now.toLocaleDateString()+' '+h+':'+m+' '+ampm

   $('body').html(time);
</code></pre>
