当前位置:网站首页>获取一星期前的时间 n-1 为含当天 一周7天 7-1
获取一星期前的时间 n-1 为含当天 一周7天 7-1
2022-08-08 23:32:00 【聰籽】
getLastweek: function (n) {
var n = n;
var d = new Date();
var year = d.getFullYear();
var mon = d.getMonth() + 1;
var day = d.getDate();
if (day <= n) {
if (mon > 1) {
mon = mon - 1;
} else {
year = year - 1;
mon = 12;
}
}
d.setDate(d.getDate() - n);
year = d.getFullYear();
mon = d.getMonth() + 1;
day = d.getDate();
s = year + "-" + (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day);
return s;
}
边栏推荐
猜你喜欢
Introduction to Qt (4) - Continuous playback of pictures (the use of two timers)
【PP-YOLOv2】训练自定义的数据集
2021 RoboCom 世界机器人开发者大赛-本科组(决赛)7-4猛犸不上 Ban(最短路)
有了国产 DevOps 工具 ,还怕数字化转型成本高?
05 Spark on 读取内部数据分区存储策略(源码角度分析)
[Pytorch] Study Notes (1)
51nod2884
mysql 高级知识【order by 排序优化】
(2022牛客多校五)B-Watches(二分)
用模态框 实现 注册 登陆
随机推荐
有了国产 DevOps 工具 ,还怕数字化转型成本高?
51nod 2882最短路 (树链剖分)
【latex异常与错误】There were undefined references.Reference `xxx‘ on page x undefined.参考引用公式编号时发生错误
MySQL indexes a field in a table
Modal dialog is used to implement the sign-in
ArrayAccess 接口用处
用模态框 实现 注册 登陆
动手写prometheus的exporter-01-Gauge(仪表盘)
(2022杭电多校六)1010-Planar graph(最小生成树)
tp5用cache缓存,存储手机短信验证码
主从延迟原因及解决方案
ndk和JNI的使用初探
2022杭电多校六 1007-Shinobu loves trip(同余方程)
树莓派wiringPi库的使用补充
深入理解计算系统第三章程序的机器级表达总结
【Tensorflow2】tensorflow1.x-tensorflow2.x一些接口的转变
用工具实现 Mock API 的整个流程
13 Spark on RDD 全局累加器
redis集群三主三从redis-cli
[PP-YOLOv2] Training a custom dataset