//获取时间
var time = new Date();
//获取年份
var year = time.getFullYear();
//获取月份 从0开始算
var month = time.getMonth()+1;
//获取月份里的第几天
var date = time.getDate();
//获取周几
var week = time.getDay();
//获取小时
var hour = time.getHours();
//获取分钟
var minute = time.getMinutes();
//获取秒
var sec = time.getSeconds();
//转化成时间戳
var newTime = time.getTime();
//时间戳转标准时间
var newTime2 = new Date(newTime);
console.log(time)
console.log(newTime)
console.log(newTime2)
//设置年份
time.setFullYear(2018)
//设置月份
time.setMonth(0)
//设置天数
time.setDate(1)
//设置小时
time.setHours();