码迷,mamicode.com
首页 > Web开发 > 详细

【js】把当前毫秒时间转换为时间戳

时间:2020-01-08 10:22:59      阅读:424      评论:0      收藏:0      [点我收藏+]

标签:val   方法   asc   gettime   date   ons   date()   console   log   

第一种方法   1498627266000

 var timestamp1 =Date.parse(new Date());
 console.log(timestamp1);

 

第二种方法   1498627266558

var timestamp2 =(new Date()).valueOf();
console.log(timestamp2);

 

第三种方法   1498627266558

var timestamp3 =new Date().getTime();
console.log(timestamp3);

 

【js】把当前毫秒时间转换为时间戳

标签:val   方法   asc   gettime   date   ons   date()   console   log   

原文地址:https://www.cnblogs.com/whblogs/p/12165015.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!