function getDateStr1(seconds){
var date = new Date(seconds*1000)
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
var currentTime = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
return currentTime
}
//getDateStr(1524637692)>
console.log(getDateStr1(1524637692))//"2018-4-25 14:28:12"```
时间戳
最新推荐文章于 2022-07-06 11:40:06 发布