最后两个答案不太懂什么意思 求大神吗讲一下
有个日期转换的例子:
Date.prototype.yyyyMMdd = function () {
var yyyy = this.getFullYear().toString();
var MM = (this.getMonth() + 1).toString()//getMonth() is zero based
var dd = this.getDate().toString();
var hh = this.getHours().toString();
var mm = this.getMinutes().toString();
var ss = this.getSeconds().toString();
return yyyy + "-" + (MM[1] ? MM : "0" + MM[0]) + "-" + (dd[1] ? dd : "0" + dd[0]) + " "
+ (hh[1] ? hh : "0" + hh[0]) + ":" + (mm[1] ? mm : "0" + mm[0]) + ":" + (ss[1] ? ss : "0" + ss[0]);
}
var newDate = new Date();
newDate.yyyyMMdd()