day() {
var nowDate = new Date();
var date = {
year: nowDate.getFullYear(),
month: nowDate.getMonth() + 1,
day: nowDate.getDate(),
}
var dayDate = date.year + '-' + (date.month >= 10 ? date.month : '0' + date.month) + '-' + (date.day >= 10 ? date.day : '0' + date.day)
console.log(dayDate);
},
打印结果: 2022-5-11
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)