js中获取日期
const date =new Date();
date.toLocaleString(); // 2023/05/01 21:20:30
定时器: //在页面实时更新
setInterval(funcation(){
const date =new Date();
date.toLocaleString();
},1000);
时间戳转换公式
d =parseInt(总秒数 / 60 / 60 / 24) 天
h =parseInt(总秒数 / 60 /60 %24) 小时
m=parseInt(总秒数 / 60 % 60)分钟
s =parseInt(总秒数 %60)秒