日期时间戳的使用与计算
new Date()的使用
const date = new Date()
console.log(date)
console.log(typeof date)
console.log(date * 1)
Date()的使用
const hd = Date()
console.log(hd)
console.log(typeof hd)
console.log(hd * 1)
Date.now()
const date1 = Date.now()
console.log(date1)
ISO与TimeStamp格式转换
const d = new Date('1996-7-12 08:22:12')
console.log(d * 1)
console.log(Number(d))
console.log(d.valueOf())
console.log(d.getTime())
const timestamp = d.valueOf()
console.log(new Date(timestamp))
Date()下可用的API
const d = new Date('1996-7-12 08:22:12')
console.log(d)
console.log(d.getFullYear())
console.log(d.getMonth() + 1)
console.log(d.getDate())
console.log(d.getHours())
console.log(d.getMinutes())
console.log(d.getSeconds())