I have this date "Wednesday, 4th Apr 2018" format and I am trying to format this in "yyyy-MM-dd". It's working fine for all months but getting issue for April and august month. I am not getting what is the issue as it's working with other months This is my code
var Arrivaldte = Date.parse("Wednesday, 4th Apr 2018").toString('yyyy-MM-dd');
console.log(Arrivaldte);