js将后台传的毫秒数转化为日期
var unixTimestamp = new Date(arr[0].birthday) ;//arr[0].birthday为毫秒数
commonTime = unixTimestamp.toLocaleString().toString();
arr[0].birthday=commonTime.substr(0,commonTime.indexOf(" "));
转换为指定格式的时间
复写toLocalString方法即可(要在调用之前复写)
Date.prototype.toLocaleString = function() {
return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate() + "/ " + this.getHours() + ":" + this.getMinutes() + ":" + this.getSeconds();
};