1706247416 转换成年月日时分秒
时间: 2024-02-01 21:10:53 浏览: 78
时间戳转年月日时分秒
以下是将时间戳转换成年月日时分秒的方法:
```javascript
var timestamp = 1706247416;
var date = new Date(timestamp * 1000);
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var day = ("0" + date.getDate()).slice(-2);
var hour = ("0" + date.getHours()).slice(-2);
var minute = ("0" + date.getMinutes()).slice(-2);
var second = ("0" + date.getSeconds()).slice(-2);
var formattedDate = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
console.log(formattedDate); // 输出:2023-10-25 15:50:16
```
阅读全文