当前位置:网站首页>Get the time n-1 a week ago including the current day 7 days a week 7-1
Get the time n-1 a week ago including the current day 7 days a week 7-1
2022-08-08 23:36:00 【Satoshi seeds】
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;
}
边栏推荐
猜你喜欢
牛客练习赛88 D 克鲁斯卡尔重构树
(2022牛客多校五)D-Birds in the tree(树形DP)
2021 RoboCom 世界机器人开发者大赛-本科组(决赛)7-1绿色围栏(模拟)
Introduction to Qt (4) - Continuous playback of pictures (the use of two timers)
51nod 2887 抓小偷 平面图最小割转换成最短路
mysql 高级知识【order by 排序优化】
postgresql源码学习(35)—— 检查点⑤-检查点中的XLog清理机制
用模态框 实现 注册 登陆
[Pytorch] Study Notes (1)
(newcoder 15079)无关(容斥原理)
随机推荐
51nod2614 小B爱旅行 (参考范艺杰代码 基本抄袭 太难了)
(2022杭电多校六)1010-Planar graph(最小生成树)
(2022牛客多校四)N-Particle Arts(思维)
freemarker的基本语法及入门基础
牛客多校2 G League of Legends
Master-slave delay reason and solution
Introduction to Qt (4) - Continuous playback of pictures (the use of two timers)
(2022牛客多校五)D-Birds in the tree(树形DP)
从stm32移植ucos2的代码到GD32
PMP考点有哪些啊?
[Tensorflow2] Some interface changes of tensorflow1.x-tensorflow2.x
MySQL 原理与优化,Group By 优化 技巧
-Wl,--start-group ... -Wl,--end-group 用于解决几个库的循环依赖关系
Hand-written prometheus exporter-01-Gauge (dashboard)
不躺平,然后做到极致,就是最大的“安全感”
容斥原理
Get the start time of the week
2022牛客多校六 A-Array(构造+哈夫曼)
时间对象的格式化
10 Spark on RDD Cache