convert D/M/YYYY to YYYY/MM/DD (ex : 1/6/2015 --> 2015/06/01 not 2015/6/1) : Hello i have to convert a date like D/M/YYYY to YYYY/MM/DD Ex : 1/6/2015 --> 2015/06/01 not 2015/6/1

I have some conditions to be met :

 - when it convert the month like Jan "1" must give : 01
Feb "2" must give : 02 etc

 - i have to use Date()

<!-- begin snippet: js hide: false -->

<!-- language: lang-js -->

    var st = "D/M/YYYY"
    var dt = new Date(st);

        	
         var maFonction = function (userdate){
        	var day = st.getDate();
          	var month = st.getMonth();
          	var year = st.getFullYear();
          	var maDate = year + "/" + day + "/" + month;
          	return maDate;
        }

        console.log(maFonction(st));


<!-- end snippet -->


I tried but it doesn't works :


I am a beginner so explain to me :)

Thanks a lot !
