5 回复
var curDate = new Date();
var year = curDate.getFullYear();
var month = curDate.getMonth() + 1;
var day = curDate.getDate();
var year1 = curDate.getHours();
var month1 = curDate.getMinutes() ;
var day1 = curDate.getSeconds();
console.log(“当前时间年月日” + year + “-” + month + “-” + day );
console.log(“当前时间时分秒” + year1 + “-” + month1 + “-” + day1);