DATE常用方法
var date = new Date() ; //获取当前时间
console.log(Date.prototype);//Date的方法有哪些
//Date.parse() //把日期转为时间戳
console.log(Date.parse(new Date())); //获取当前时间戳
var t1 = new Date("2018/01/01 08:08:08"); //指定日期
console.log(Date.parse(t1)); //指定日期的时间戳
//经测试 -0 也可以得到日期的时间戳
console.log(t1-0); //指定日期的时间戳
var t2 = new Date(t1-0);
/**
用时间戳取得日期
getDate() ;
//指定格式
getFullYear() ;// 年
getMonth() ;//月 + 1
getDate() ;//日
getHours() ;//时
getMinutes() ;//分
getSeconds() ;//秒
*/
console.log(t2.getDate());
console.log(t2.getFullYear() + "-" + (t2.getMonth() + 1) + "-" + t2.getDate() +" "
+ t2.getHours() + ":" + t2.getMinutes()+":"+t2.getSeconds()) ;