Можно как-то так:
function randomDate(start, end) {
return new Date(start.getTime()
+ Math.random() * (end.getTime() - start.getTime()));
}
var myDate = randomDate(new Date(2012, 0, 1), new Date());
console.log(myDate.getFullYear() + '-'
+ ('0' + (myDate.getMonth() + 1)).slice(-2)
+ '-' + ('0' + myDate.getDate()).slice(-2)
+ ' '
+ ('0' + myDate.getHours()).slice(-2)
+ ':' + ('0' + myDate.getMinutes()).slice(-2)
+ ':' + ('0' + myDate.getSeconds()).slice(-2)
);