//方法一
var timestamp = (new Date()).getTime(); console.log(timestamp); //1495302061441
//方法二
var timestamp2 = (new Date()).valueOf(); console.log(timestamp2); //1495302061447
//方法三
var timestamp3 = Date.parse(new Date()); console.log(timestamp3);//1495302061000
第一种和第二种是获取了当前毫秒的时间戳
最后一种获取的时间戳是把毫秒改成000显示
来源:https://www.cnblogs.com/eternityz/p/12271948.html