码迷,mamicode.com
首页 > 其他好文 > 详细

时间戳与时间的转化

时间:2018-04-23 18:50:47      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:function   nbsp   class   etl   span   date()   date   time   ret   

时间戳转化为时间:

$scope.getLocalTime = function (n) {
        return new Date(n).toLocaleDateString();
};

时间转化为时间戳:

var date = new Date(); // 当前时间
console.log(date.getTime());
var d2 = new Date(2018,4,23);
console.log(d2.getTime());

 

时间戳与时间的转化

标签:function   nbsp   class   etl   span   date()   date   time   ret   

原文地址:https://www.cnblogs.com/miacara94/p/8920306.html

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