vue中获取当前日期(年月日)
addDate() {var nowDate = new Date();var date = {year: nowDate.getFullYear(),month: nowDate.getMonth() + 1,date: nowDate.getDate(),}var systemDate = date.year + ‘-’ + 0 + date.month + ‘-’ + 0 + date.da
·
addDate() {
var nowDate = new Date();
var date = {
year: nowDate.getFullYear(),
month: nowDate.getMonth() + 1,
day: nowDate.getDate(),
}
var systemDate = date.year + ‘-’ + (date.month >= 10 ? date.month : ‘0’ + date.month) + ‘-’ + (date.day >= 10 ? date.day : ‘0’ + date.day)
console.log(systemDate);
}
更多推荐
已为社区贡献1条内容
所有评论(0)