Loading... ```js let now = new Date(); let Now = now.getTime(); //当前时间戳 let nowYear = now.getFullYear(); //当前年 let nowMonth = now.getMonth();//当前月 let nowDay = now.toLocaleDateString();//当前天 let firstDay = new Date(nowYear, nowMonth, 1).getTime()//本月开始时间戳 let LastDay = new Date(nowYear, nowMonth + 1, 0).getTime(); // 本月结束时间戳 let Day = new Date(nowDay).getTime(); // 当天0点时间戳 let yesterday = new Date(nowDay).getTime() - 86400000; // 昨天时间戳, 86400000为24h的时间戳 let beforeYesterday = new Date(nowDay).getTime() - 86400000 * 2; // 前天时间戳 ``` 最后修改:2023 年 02 月 14 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏