How to convert date text with javascript?
<p>how to convert this</p>

<pre><code>Sun Jan 08 2012 00:00:00 GMT+0530 (Sri Lanka Standard Time)
</code></pre>

<p>into</p>

<pre><code>2012-01-08
</code></pre>

<p>with javascript?</p>

<p>Regards</p>

<p><strong>Edit:</strong> </p>

<p>i was actually working with extjs and didn't know there is a built in way to do this with extjs</p>

<p>so i manage to do this</p>

<pre><code>var date = new Date("Sun Jan 08 2012 00:00:00 GMT+0530 (Sri Lanka Standard Time)");
console.log(Ext.Date.format(date, 'Y-m-d'));
</code></pre>

<p>which gives me <strong>2012-01-08</strong></p>
