// 1、时间戳转化成时间格式
function getTime(times) {
return new Date(parseInt(times) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
} // 2、时间戳转换为距离现在多长时间
function getTimeUntilNow(mss) {
var days = parseInt(mss / (1000 * 60 * 60 * 24));
if (days > 0) {
return days + " 天前";
};
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
if (hours > 0) {
return hours + " 小时前 ";
};
var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
if (minutes > 0) {
return minutes + " 分钟前 ";
};
var seconds = (mss % (1000 * 60)) / 1000;
return "刚刚 ";
}