时间对象
// 时间对象
var date = new Date()
console.log(date) //自动转为字符串
// new Date 传参
// 1个参数 毫秒数
var date1 = new Date(1000)
console.log(date1)
// 1970 1 1 0:0:1
// 2个参数 3个参数 对应年月日 时分秒
// 2023年 11月 3号 月份从0开始
var date2 = new Date(2023, 10, 3)
// 字符串 2023年 十点十分十秒
var date3 = new Date("2023-10-10 10:10:10")
var date4 = new Date("2023/10/10 10:10:10")
时间对象的常用方法
var date = new Date()
// 获取年份
console.log(date.getFullYear())
// 获取月份
console.log(date.getMonth())
// 日 (几号)
console.log(date.getDate())
// 周日0 周一-周六 1-6
console.log(date.getDay())