写了一个把毫秒数日期转成 yyyy-mm-dd HH:mm:ss的方法,保存备用。
function getDateTimeStr(date){
var temp = new Date(date);
var y = temp.getFullYear();
var m = (temp.getMonth()+1)+"";
m = m.length >1? m:"0"+m;
var d = temp.getDate()+"";
d = d.length >1? d:"0"+d;
var hh = temp.getHours()+"";
hh = hh.length >1? hh:"0"+hh;
var mm = temp.getMinutes()+"";
mm = mm.length >1? mm:"0"+mm;
var ss = temp.getSeconds()+"";
ss = ss.length >1? ss:"0"+ss;
return y+"-"+m+"-"+d+" "+hh+":"+mm+":"+ss;
}