时间处理总结(三)javascript与WCF
1.WCF提交时间时,若需接受DateTime需转换为"\/Date(928120800000+0800)\/"这种格式
        var DateToJson = function (jsDate) {
            return "\/Date(" + jsDate.getTime() + "+0800)\/";
        }
        2.服务端返回的时间json字段"\/Date(928120800000+0800)\/"转为时间空间可以显示的值
        var JsonTodate = function (jsondate) {
            jsondate = jsondate.replace("/Date(", "").replace(")/", "");
            if (jsondate.indexOf("+") > 0) {
                jsondate = jsondate.substring(0, jsondate.indexOf("+"));
            }
            else if (jsondate.indexOf("-") > 0) {
                jsondate = jsondate.substring(0, jsondate.indexOf("-"));
            }
            var date = new Date(parseInt(jsondate, 10));
            return date;
        }
                    
                
                
            
        
浙公网安备 33010602011771号