function getDate () {
var newDate = new Date(),
Year = newDate.getFullYear(),
Month = newDate.getMonth() + 1,
Day = newDate.getDate(),
nowDate = '';
if (Month >= 1 && Month <= 9) {
Month = "0" + Month;
}
if (Day >= 1 && Day <= 9) {
Day = "0" + Day;
}
return nowDate = Year + '-' + Month + '-' + Day;
}
借鉴过来的,感觉是比较淳朴的方法