//自定义日期转换合适
Date.prototype.toLocaleString = function() {
//return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate() + " " + this.getHours() + ":" + this.getMinutes() + ":" + this.getSeconds();
return this.getFullYear() + "-" + (this.getMonth() + 1) + "-" + this.getDate();
};
var time= new Date(1512696580915);
time= time.toLocaleString();
alert(time);
网友评论