其他分享
首页 > 其他分享> > 年月日

年月日

作者:互联网

return(  nowTime: this.$moment(new Date()).format('HH:mm:ss'),  nowDay: this.formatDate(),  nowWeek: this.getWeekDate(), ) methods:{ //  年月日       formatDate() {       const date = new Date()       var year = date.getFullYear()       var month = date.getMonth() + 1       var weekday = date.getDate()       if (month < 10) {         month = '0' + month       }       if (weekday < 10) {         weekday = '0' + weekday       }       return year + '年' + month + '月' + weekday + '日'     }, //  星期     getWeekDate() {       const day = new Date().getDay()       const weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']       return weeks[day]     } }  

标签:const,month,var,weekday,date,new,年月日
来源: https://www.cnblogs.com/benbenbai/p/15867981.html