new Date() 对象的格式处理
new Date(year,month,date,hrs,min,sec) 可以用 2021/2/18 这种格式 不可以用2021-2-18
date = new Date() 获取当前时间戳
年: date.getFullYear()
月:date.getMonth() + 1
日:day = date.getDate() day < 10 ? (‘0’ + day ): day
转换时间戳(毫秒)
date.getTime / 1000 单位为秒(可以用这个来判断两个时间差,比如超过了24小时等等)
获取当前月份最后一天
let date = new Date()
lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0) 得出结果“2021/2/28”
lastDay.getDate() 得出结果 28