<script>
//设置日期对象
let d = new Date()
//获取年份
let year = d.getFullYear()
console.log(year)
//获取月份
let mon = d.getMonth() + 1
console.log(mon)
//获取日
let date = d.getDate()
console.log(date)
//获取星期
let day = d.getDay()
console.log(day)
//获取小时
let hours = d.getHours()
console.log(hours)
//获取分钟
let minutes = d.getMinutes()
console.log(minutes)
//获取秒
let seconds = d.getSeconds()
console.log(seconds)
</script>