function formatDate(date) {标签:getSeconds,getMinutes,10,getHours,JS,var,时间,date From: https://www.cnblogs.com/fuxp/p/18013426
var date = new Date(date);
var YY = date.getFullYear() + '-';
var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
return MM + DD;
// return MM + DD +' '+ hh + mm + ss;
}
调用:formatDate(res['odate']*1000)