Is there a clean way of adding a 0 in front of the day or month when the day or month is less than 10:
var myDate = new Date(); var prettyDate =(myDate.getFu
The format you seem to want looks like ISO. So take advantage of toISOString():
toISOString()
var d = new Date(); var date = d.toISOString().slice(0,10); // "2014-05-12"