计算时间戳
<script>
var date1 = new Date('2022-04-01 00:00:00');
var t2 =date1.getTime();
var t1 = Date.now();
var myTime = (t2-t1)/1000;
var d= Math.floor(myTime/60/60/24);
d = d<10? '0'+d:d;
var h= Math.floor(myTime/60/60%24);
h = h<10? '0'+h:h;
var m=Math.floor(myTime/60%60);
m = m<10?'0'+m:m;
var s=Math.floor(myTime%60);
s = s<10?'0'+s:s;
alert(d+"天"+h+"时"+m+'分'+s+'秒');
</script>
03天08时42分46秒