function switchDate(standardTime) {
if (standardTime != "") {
let a = standardTime;
var Month = a.getMonth() + 1;
var MonthDate;
var DayDate = a.getDate();
var Day;
if (Month < 10) {
MonthDate = '0' + Month;
} else {
MonthDate = Month;
}
if (DayDate < 10) {
Day = '0' + DayDate;
} else {
Day = DayDate;
}
var datetime = a.getFullYear() + "-" + MonthDate + "-" + Day;
console.log(datetime)
return datetime
}
}
中国标准时间standardTime = Sat Jan 01 1994 00:00:00 GMT+0800 (中国标准时间) 转之后是datetime = 1994-01-01