const moment = require('moment'); //时间日期转换模块获取当前时间戳 秒级let newTimes = Math.round(new Date().getTime() / 1000)时间戳转日期 注意 HH表示24小时 hh表示12小时制let rrecently = moment.unix(newTimes).format("YYYY-MM-DD HH:mm:ss");//使用时间日期转时间戳let d =moment(time).unix();//日期转时间戳时间戳对比let res= Math.round(new Date().getTime()/1000)let res2= Math.round(new Date().getTime()/1000+10 )let b= moment(res2).diff(moment(res), 'X');//小写x表示毫秒,大写X表示秒 ==>相差 10 秒Res2 是过期时间 res 是当前时间
