<!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>
js获取到时间戳(兼容性强)
原创
©著作权归作者所有:来自51CTO博客作者Vam的金豆之路的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:十分钟快速实战Three.js
下一篇:js深拷贝浅拷贝
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
day.js 时间戳
day.js 的时间戳 希望大家可以补充
时间段 时间戳 时间处理 -
兼容性js实现
页面载入完成事件.js中window.onload=function(){}因为在ff中,body.onload不响应;
function html ie 自定义 -
js let在android上的兼容性 javascript兼容性
使用JavaScript检测浏览器的相关特性 一、检测浏览器的名称 问题: 不同的浏览器对 JavaScript 的标准支持也有不同,有时希望脚本能够在不同的浏览器上都能运行良好,这时需要对浏览器进行检测,确定其名称,以针对不同的浏览器编写相应的脚本。 解决方案: 使
js let在android上的兼容性 javascript 浏览器 xmlhttprequest function