1、格式化为yyyy-MM-dd
function setDefaultDate() {
var nowDate = new Date();
var month = nowDate.getMonth() + 1;
var day = nowDate.getDate();
month = (month.toString().length == 1) ? ("0" + month) : month;
day = (day.toString().length == 1) ? ("0" + day) : day;
//当前日期 yyyy-MM-dd
return nowDate.getFullYear() + '-' + month + '-' + day;
}
需要格式化成什么格式的可根据实际进行变化