解决方案 »

  1.   

    /Date(1410019200000+0800)/ 是通过eval(value.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"))得到的
    其中的value是json序列化日期后的东西
    再通过一个date的扩展方法转换为人能看懂的时间字符串
      

  2.   

    s = '/Date(1410019200000+0800)/ ';
    s.replace(/Date\([\d+]+\)/, function(a) { eval('d = new '+a) });
    alert(d);
      

  3.   

    <script type="text/javascript">
            var date=new Date(1410019200000+0800);
             
            Date.prototype.format = function(format){ 
                var o = { 
                "M+" : this.getMonth()+1, //month 
                "d+" : this.getDate(), //day 
                "h+" : this.getHours(), //hour 
                "m+" : this.getMinutes(), //minute 
                "s+" : this.getSeconds(), //second 
                "q+" : Math.floor((this.getMonth()+3)/3), //quarter 
                "S" : this.getMilliseconds() //millisecond 
                } 
     
                if(/(y+)/.test(format)) { 
                format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
                } 
     
                for(var k in o) { 
                if(new RegExp("("+ k +")").test(format)) { 
                format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); 
                } 
                } 
                return format; 
            } 
           document.write(date.format("yyyy-MM-dd hh:mm:ss"));
        </script>
    喂猫邀请我 我不认识你
      

  4.   


    var date=new Date(1410019200000+0800);
    document.write(date);//输出  Sun Sep 07 2014 00:00:00 GMT+0800 (中国标准时间)
    document.write(date.toLocaleString());//输出  2014年9月7日 上午12:00:00  参考 http://www.w3school.com.cn/jsref/jsref_toLocaleString.asp
      

  5.   

    似乎new Date(1410019200000+0800)就是我想要的答案
      

  6.   

    1410019200000是一个毫秒级的timespan,+8是时区~~
      

  7.   

    和我的时间转换方法基本一样,我只是改成了普通方法而不是date对象的扩展方法 但是
    但是在执行到 "M+" : this.getMonth()+1, //month 就会报错
    因为传入的date对象无效 我在chrome中监视 看到是个对象而不是字符串 
    待转换的date对象如果像上面一样写死 这个方法可以执行成功 但是通过这种放大得到待转换的时间对象再传入方法就会报错value = eval(value.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"));
            return TimeFormat(value, 'yyyy-MM-dd hh:mm:ss');第一句是将字符串转换成date对象 你们提供的解决方法都只是将date对象转换为制定格式字符串这下半部分 本来我也以为是下半部分的问题 但是明明按照var date=new Date(1410019200000+0800);传入是可以转换的 说明还是传入方法的date对象有问题 我也换了各个版本的jq试过都是一样的错误看来并非jq版本的问题 上面那个eval转换为date对象的方法有问题吗还是大家有其他解决办法