Ajax问题。。用AJAX从数据库查出来的时间类型转型
如题:
用AJAX从数据库查出来的时间类型转型,
转为Datetime类型
如果不转就会是这样的:/Date(1323878400000)/
我要转为:2011-01-02
请指教???
------解决方案--------------------这样
function ParseDate(jsonDate) {
 var date = new Date(parseInt(jsonDate.substr(6)));
 y = date.getFullYear()
 m = date.getMonth() + 1;
 d = date.getDate();
 str = y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d)
 return str;
}    
alert(ParseDate("/Date(1323878400000)/"))
------解决方案--------------------function ParseDate(jsonDate) {
 var date = new Date(parseInt(jsonDate.substr(6)));
 y = date.getFullYear()
 m = date.getMonth() + 1;
 d = date.getDate();
 str = y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d)
 return str;
}  
alert(ParseDate("/Date(1323878400000)/"))
------解决方案--------------------
JScript code
 var Dtime =" /Date(1323100800000+0800)/";
                       var NewDtime = new Date(parseInt(Dtime.slice(6, 19)));
                       var Dyear = NewDtime.getFullYear();
                       var Dmonth = NewDtime.getMonth() + 1;
                       var Ddate = NewDtime.getDate();