function time(time = +new Date()) { var date = new Date(time + 8 * 3600 * 1000); // 增加8小时 return date.toJSON().substr(0, 19).replace('T', ' '); console.log(time(1579046400000)) //时间戳为十三位直接输入 时间戳为十位需要将时间乘以1000
三行代码实现从时间戳转换成时间
猜你喜欢
转载自www.cnblogs.com/dongdong1996/p/12180023.html
今日推荐
周排行