/**
* 获取上个月当前时间
* @returns {Date}
*/
function getLastMonthDate() {
let date = new Date();
let lastMonth = date.getMonth() - 1;
if (lastMonth < 0) {
date.setFullYear(date.getFullYear() - 1);
date.setMonth(11);
} else {
date.setMonth(lastMonth);
}
return date
}
js获取上个月当前时间
最新推荐文章于 2023-01-09 13:30:57 发布