let _time="Tue Mar 20 2018 00:00:00 GMT+0800 (中国标准时间)";
console.log(Date.parse(_time) / 1000);

打印结果:

中国标准时间、‘yyyy-MM-dd’格式时间转为时间戳

‘yyyy-MM-dd’格式时间转为时间戳

let _time="2018-09-10";
console.log(Date.parse(new Date(_time)) / 1000);

打印结果:

中国标准时间、‘yyyy-MM-dd’格式时间转为时间戳

中国标准时间转‘yyyy-MM-dd’时间格式

let _time="Fri Feb 02 2018 00:00:00 GMT+0800 (中国标准时间)";
console.log(new Date(_time).toLocaleDateString().slice().replace(/\//g, '-'));

打印结果:

中国标准时间、‘yyyy-MM-dd’格式时间转为时间戳

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案