有时前后端交互需要传递时间戳。获取时间戳的方法如下:

 

  console.log( Date.parse(new Date()) ) // 1574318285000 精确到秒
  console.log( (new Date()).valueOf() ) // 1574318285290 精确到毫秒
  console.log( new Date().getTime()) // 1574318285290 精确到毫秒

 

相关文章:

  • 2023-03-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-07-20
猜你喜欢
  • 2021-06-09
  • 2021-12-28
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
相关资源
相似解决方案