<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>时间戳(1532249295.179) 转日期格式(2018/07/22 16:48:15 179)</title>
<style type="text/css">
</style>
</head>
<body>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var time = 1532249295.179;
function formatDateTime (inputTime) {
var date = new Date(inputTime);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
return y + '/' + m + '/' + d + ' ' + h + ':' + minute + ':' + second + ' ' + date.getMilliseconds();
}
var temp = formatDateTime(time * 1000);
console.log(temp); //2018/07/22 16:48:15 179
})
</script>
</body>
</html>