//创建方法
DateDiffer(Date_end){
//date1结束时间
let date1 = new Date(Date_end);
//date2当前时间
let date2 = new Date();
date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
const diff = date1.getTime() - date2.getTime(); //目标时间减去当前时间
const diffDate = diff / (24 * 60 * 60 * 1000); //计算当前时间与结束时间之间相差天数
}
js计算剩余天数:计算结束日期减当前日期剩余的天数
猜你喜欢
转载自blog.csdn.net/weixin_44168948/article/details/121496356
今日推荐
周排行