json时间格式转成js时间

function p(s) {
             return s < 10 ? '0' + s : s;
         }
function jsonTimeFormat(str) {
             //var str = "/Date(1283457528340)/";
             var matches = str.match(/([0-9]+)/);
             var d = parseInt(matches[0]);
             var obj = new Date(d);
             var year = obj.getFullYear();
             var month = obj.getMonth() + 1;
             var day = obj.getDate();

             var mytime = year + "-" + p(month) + "-" + p(day) + " " + p(obj.getHours()) + ":" + p(obj.getMinutes())+":"+p(obj.getSeconds());
             return mytime;
         }
str ="/Date(1283457528340)/";

原文地址:https://www.cnblogs.com/wubh/p/2632252.html