Skip to content

时间戳转换

需要的时间格式: Tue, 15 Nov 2022 12:58:27 +0800

ts
const date = new Date(pubDate); // 时间对象
// 月份数据定义
const months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
// 22 April 2024
const string = date.getUTCDate() + " " + months[date.getUTCMonth()] + " " + date.getUTCFullYear()
//17:36
const time = date.getUTCHours() + ":" + date.getUTCMinutes()  + ":" + date.getUTCSeconds();
console.log(time);
console.log(string);
console.log(date);

前端空格格式

  // 不换行空格
  // 半角空格
  // 全角空格
  // 最窄空格

https://blog.csdn.net/yjm239/article/details/2153225

waitingresult.com