时间格式化参考:https://www.cnblogs.com/zhoushuang0426/p/10559172.html
js获取当前时间戳;指定时间转换时间戳;时间戳转换时间:参考https://blog.csdn.net/qq_37896578/article/details/90080953?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.add_param_isCf&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.add_param_isCf
当天0点的时间戳:
const timestamp = new Date( new Date(new Date().toLocaleDateString()).getTime() ).getTime() / 1000 console.log('-----') console.log(timestamp)
一周前的0点时间戳:
const timestamp = new Date( new Date(new Date().toLocaleDateString()).getTime() - 7 * 24 * 3600 * 1000 ).getTime() / 1000 console.log(timestamp)
当天的30天前的0点时间戳:
const timestamp = new Date( new Date(new Date().toLocaleDateString()).getTime() - 30 * 24 * 3600 * 1000 ).getTime() / 1000 console.log(timestamp)
在线时间戳转换工具:https://www.matools.com/timestamp