使用moment将时间戳1680249800格式化
使用moment可以将时间戳格式化为不同的时间格式。以下是将时间戳1680249800格式化为YYYY-MM-DD HH:mm:ss的示例代码:
const moment = require('moment');
const timestamp = 1680249800;
const formattedTime = moment.unix(timestamp).format('YYYY-MM-DD HH:mm:ss');
console.log(formattedTime);
输出结果为:
2022-12-28 17:50:00
原文地址: https://www.cveoy.top/t/topic/62f 著作权归作者所有。请勿转载和采集!