// 时间转换
function parseDateTime(num) {
if (!!!num) {
return "";
}
//最后的消息时间
var date = new Date(+num);
//console.log(date)
//当前时间
var nowDate = new Date();
//今日零点时间
var nowDay = new Date(nowDate.getFullYear() + "-" + (+nowDate.getMonth() + 1) + "-" + nowDate.getDate());
var hms = date.getHours() + ":" + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) + ":" + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds());
if (date.getTime() >= nowDay.getTime()) {
return hms;
}
if (nowDay.getTime() - 1000 * 60 * 60 * 24 <= date.getTime()) {
// return $L("yesterday") + " " + hms;
return '昨天' + " " + hms;
}
var month = (+date.getMonth() + 1) < 10 ? "0" + (+date.getMonth() + 1) : (+date.getMonth() + 1);
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
if (date.getFullYear() == nowDate.getFullYear()) {
return month + "-" + day + " " + hms;
}
return (date.getFullYear() + "").substr(2, 4) + "-" + month + "-" + day + " " + hms;
};