js获取时间戳的三种方式

js获取时间戳的三种方式

CreateTime--2018年5月23日08:44:10

Author:Marydon 

// 方式一:推荐使用
var timestamp=new Date().getTime();
console.log(timestamp);
// 方式二
timestamp = (new Date()).valueOf();
console.log(timestamp);
// 方式三
timestamp = Date.parse(new Date());
console.log(timestamp);

效果展示

原文地址:https://www.cnblogs.com/Marydon20170307/p/9075164.html