其他分享
首页 > 其他分享> > js获取到时间戳(兼容性强)

js获取到时间戳(兼容性强)

作者:互联网

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<script>
  function thedata(d){
      return d.replace(/\-/g, "\/")
  }
  var serverTime = parseInt(new Date(thedata('2020-08-12 15:52:11')).valueOf());
  console.log(serverTime); // 1597218731000,获取到时间戳
</script>
</body>
</html>

 

更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/119997616

标签:兼容性,valueOf,serverTime,js,获取,thedata,原文,replace
来源: https://www.cnblogs.com/wangchuanxinshi/p/16410135.html