SOURCE

// 获取时间对象
var date = new Date()
// getFullYear获取当前年份
const nowYear = date.getFullYear()
// getMonth+1 获取当前月份
const nowMonth = date.getMonth() + 1
// getDate 获取当前日期
const nowDate = date.getDate()
const weekDay = ['星期天','星期一','星期二','星期三','星期四','星期五','星期六','星期天']
const nowWeek = weekDay[date.getDay()]
// getHours 获取小时
const nowHour = date.getHours()
// getMinutes 获取分
const nowMinute = date.getMinutes()
// getSeconds 获取秒
const nowSecond = date.getSeconds()
console.log(date,nowYear,nowMonth)
console.log(nowYear + '年' + nowMonth + '月'+  nowDate +'日'+ nowWeek + nowHour + ':' + nowMinute + ':' + nowSecond)
console 命令行工具 X clear

                    
>
console