I have tried this code but it gives me the date in the wrong format:
function randomDate(start, end) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
}
randomDate(new Date(2012, 0, 1), new Date())
returns a date like this
Fri Dec 16 1988 06:20:22 GMT+0000 (GMT Standard Time)
How would i change it to the "yyyy-mm-dd" format? so for example
1985-09-22