首页 > 其他 > 详细

时间格式转换—将后台返回的/Date(1448954018000)/格式转换为正常的时间格式

时间:2016-12-22 19:31:02      阅读:789      评论:0      收藏:0      [点我收藏+]

用JS实现方法:

function ChangeDateFormat(cellval) {

            var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10));

            var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;

            var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();

            return date.getFullYear() + "-" + month + "-" + currentDate;

        }

 

时间格式转换—将后台返回的/Date(1448954018000)/格式转换为正常的时间格式

原文:http://www.cnblogs.com/shuai7boy/p/6211983.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!