let currentDate = new Date();
let targetDateObj = new Date('2023-09-13');
currentDate.setHours(0, 0, 0, 0);
targetDateObj.setHours(0, 0, 0, 0);
const timeDifference = Math.abs(currentDate - targetDateObj);
return Math.ceil(timeDifference / (1000 * 3600 * 24));
JS获取日期相差多少天
最新推荐文章于 2024-04-17 11:15:00 发布