获取一个日期的年月日周

getYMD (date) {
let year = date.getFullYear()
let month = (date.getMonth() + 1 > 9) ? (date.getMonth() + 1 + '') : ('0' + (date.getMonth() + 1))
let day = (date.getDate() > 9) ? (date.getDate() + '') : ('0' + date.getDate())
let week = date.getDay()
return [year, month, day, week]
}

猜你喜欢

转载自www.cnblogs.com/langqq/p/9176242.html