欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 家装 > vue获取最近7天时间;获取任意时间段时间

vue获取最近7天时间;获取任意时间段时间

2024/10/25 9:30:47 来源:https://blog.csdn.net/Aa12364567/article/details/142346048  浏览:    关键词:vue获取最近7天时间;获取任意时间段时间
/** 获取当前7天时间 */
function fun_date(aa) {var date1 = new Date(),month1 = date1.getMonth() < 9 ? '0' + (date1.getMonth() + 1) : date1.getMonth() + 1,day1 = date1.getDate() < 10 ? '0' + date1.getDate() : date1.getDate(),time1 = date1.getFullYear() + '-' + month1 + '-' + day1var date2 = new Date(date1);date2.setDate(date1.getDate() + aa);var month2 = date2.getMonth() < 9 ? '0' + (date2.getMonth() + 1) : date2.getMonth() + 1,day2 = date2.getDate() < 10 ? '0' + date2.getDate() : date2.getDate(),time2 = date2.getFullYear() + '-' + month2 + '-' + day2startTime.value = time2endTime.value = time1dateRange.value = [startTime.value, endTime.value]
}
fun_date(7);//7天后的日期
fun_date(-7);//7天前的日期

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com