时间处理函数
// 时间转换 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; };
一辈子很短,努力的做好两件事就好;第一件事是热爱生活,好好的去爱身边的人;第二件事是努力学习,在工作中取得不一样的成绩,实现自己的价值,而不是仅仅为了赚钱;