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

jquery中将序列化成json的日期转化为普通日期格式

时间:2019-06-04 13:29:44      阅读:336      评论:0      收藏:0      [点我收藏+]

标签:nts   class   get   图片   mil   http   minutes   日期格   转化   

技术图片

 

 

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 currentDay = date.getDate() <10 ? "0" +date.getDate() : date.getDate();
    var currentHour = date.getHours() < 10 ? "0" +date.getHours() :date.getHours();
    var currentMinute = date.getMinutes() < 10 ? "0" +date.getMinutes() :date.getMinutes();
    var currentSecond = date.getSeconds() < 10 ? "0" +date.getSeconds() :date.getSeconds();
    return date.getFullYear() + ‘-‘ + month + "-" + currentDay + " " + currentHour+ ":" + currentMinute + ":" + currentSecond;
}

 

 

 

 

 

 

 

        

 

jquery中将序列化成json的日期转化为普通日期格式

标签:nts   class   get   图片   mil   http   minutes   日期格   转化   

原文地址:https://www.cnblogs.com/xifengmo/p/10972820.html

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