我知道网上已经对此进行了一些介绍,但不幸的是,我仍然不太确定如何修改这段特定的代码:
timeCreated: function(dateString) {
var date = new Date(dateString);
var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
var hh = date.getHours();
var m = date.getMinutes();
var dd = "AM";
var h = hh;
if (h >= 12) {
h = hh-12;
dd = "PM";
}
if (h == 0) {
h = 12;
}
return h + ':' + date.getMinutes().toString() + ' ' + dd + ' ' + monthNames[date.getMonth()] + ', ' + date.getDate().toString() + ', ' + date.getFullYear().toString();
}
dateString 输出为Tue Nov 06 23:29:33 +0000 2012
.