function getTime(num) {
let time = num || 0;
let secDate =Date.now() +(time*86400000)
let date = new Date(secDate);
let year = date.getFullYear();
let month = date.getMonth() + 1; //
let day = date.getDate();
let m = month < 10 ? `0${month}` : month;
let d = day < 10 ? `0${day}` : day;
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
hour = hour < 10 ? `0${hour}` : hour;
minute = minute < 10 ? `0${minute}` : minute;
second = second < 10 ? `0${second}` : second;
return year + "-" + m + "-" + d + " " + hour + ":" + minute + ":" + second;
}
获取当前时间和当前时间的前几天后几天
最新推荐文章于 2024-11-01 14:48:20 发布