返回当前时间

curTime() {
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
if (month < 10) {
month = parseInt('0') + month;
}
if (day < 10) {
day = parseInt('0') + day;
}
let str = year + '-' + month + '-' + day;
return str;
}

你可能感兴趣的:(返回当前时间)