xiangsj

js 取得今天0点:

const start = new Date(new Date(new Date().toLocaleDateString()).getTime());
console.log(start); //Mon Dec 04 2017 00:00:00 GMT+0800 (中国标准时间)

同理算出:

js 取得今天 23:59:59

const start = new Date(new Date(new Date().toLocaleDateString()).getTime()+24*60*60*1000-1);
console.log(start); //Mon Dec 04 2017 23:59:59 GMT+0800 (中国标准时间)

其他也是同理类推

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案