How to format dates in javascript
<p>I pick this date from a textbox and i would like to format to this format: yyyy-MM-dd
So from dd/MM/yyyy to yyyy-MM-dd</p>

<pre><code> var startDate = document.getElementById('ctl00_PlaceHolderMain_ctl00_Date').value;
    var s = new Date(startDate);
    alert(startDate); //which prints out 7/03/2012
    //when i use the below to try and format it to : yyyy-MM-dd which is what i want
    var scurr_date = s.getDate();
    var scurr_month = s.getMonth();
    scurr_month++;
    var scurr_year = s.getFullYear();
</code></pre>

<p>For some reason i get:</p>

<pre><code>var fstartdate = scurr_year + "-" + scurr_month + "-" + scurr_date;
//Output:2012-7-3
instead of : 2012-3-7
also fi i pick a date like 31/12/2011
i get : 2013-7-12
</code></pre>

<p>Any ideas what to do.I kind of notice if i use US like 03/07/2012 it kind os works ok.
Thank in advance</p>
