I have a date with the format Sun May 11,2014. How can I convert it to 2014-05-11 using JavaScript?
Sun May 11,2014
2014-05-11
.toJSON().slice(0,10);
var d = new Date('Sun May 11,2014' +' UTC'); // Parse as UTC let str = d.toJSON().slice(0,10); // Show as UTC console.log(str);