解决方法
要将MysqL DATETIME字符串转换为JavaScript Date对象:
var sqlDateStr = "2012-01-02 23:58:59"; // as for MysqL DATETIME sqlDateStr = sqlDateStr.replace(/:| /g,"-"); var YMDhms = sqlDateStr.split("-"); var sqlDate = new Date(); sqlDate.setFullYear(parseInt(YMDhms[0]),parseInt(YMDhms[1])-1,parseInt(YMDhms[2])); sqlDate.setHours(parseInt(YMDhms[3]),parseInt(YMDhms[4]),parseInt(YMDhms[5]),0/*msValue*/); alert(sqlDate);