var year = new Date().getFullYear(),//计算当前年份
month = new Date().getMonth()+1,//计算当前月份
dates = new Date().getDate(),//计算当前日期
week = new Date().getDay(),//计算当前前是周几
hours = new Date().getHours(),//计算当前的是几点
minutes = new Date().getMinutes(),
seconds = new Date().getSeconds(),
currentTime = new Date().getTime(),//得到当前时间的毫秒数
dayCount = new Date(year,month,0).getDate(),//计算当前月一共有几天
localTime = new Date().toLocaleString();//获得当地时间
function formatTime(time){//time是传入的毫秒数
let dates = new Date(time)
return (dates.getFullYear())+’-’+(dates.getMonth()+1)+’-’+dates.getDate()
}