从后台取出来的数据是Aug 5, 2015 4:10:10 PM , 简直约等于乱码, 所以研究出了一个JS方法来改格式
function dateFormat(sdate) {
if(!sdate){
return "";
}
var date = new Date(sdate);
var year = date.getFullYear();
var month = date.getMonth();//(1 + date.getMonth()).toString();
//month = month.length > 1 ? month : '0' + month;
var day = date.getDate().toString();
//day = day.length > 1 ? day : '0' + day;
var result = "";
var now = new Date();
var nowYear = now.getFullYear();
var nowMonth = now.getMonth().toString();
var nowDay = now.getDate().toString();
/* if (nowYear > year) {
result += year + '/';
} */
/* if (!(nowMonth == month && nowDay == day)) {
} else {
} */
result += year + '年';
result +=(month + 1) + '月' + day + '日'+ date.getHours() + ':' + fit(date.getMinutes());
return result;
}
得到的结果是2015年8月5日16:10 ,perfect!