当前位置:网站首页>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;
}
边栏推荐
- 最小生成树prim 求得 树上两点之间的最大最小值
- 【latex异常与错误】There were undefined references.Reference `xxx‘ on page x undefined.参考引用公式编号时发生错误
- 获取当前时间的前/后某一天的日期
- stm32 uses serial port to receive idle interrupt + dma to achieve variable length dma reception
- 09 Spark on RDD 阶段划分
- 最详树莓派4B装机流程及ifconfig不到wlan0的解决办法
- [Bug solution] ValueError: Object arrays cannot be loaded when allow_pickle=False
- WeChat applet develops some function usage methods
- 循环神经网络实现股票预测
- 06 Spark on RDD序列化问题
猜你喜欢
随机推荐
51nod 1830
Share | design based on MCU P0 mouth to drive the LED flashing
WeChat applet develops some function usage methods
Excel 2013 下拉为“快速分拆”调整为“填充序号”
MySQL 原理与优化,Group By 优化 技巧
官方一键安装redis集群
pytorch常用代码
MySQL 高级知识【 MyISAM 读锁写锁限制】
PHP闭包函数 bingTo的使用
时间对象的格式化
-Wl,--start-group ... -Wl,--end-group for resolving circular dependencies of several libraries
获取半年前当月的开始时间及当天结束时间
AsyncTask的替代方案
(codeforce547)C-Mike and Foam(质因子+容斥原理)
关于notepad++的js,xml插件安装
(2022牛客多校四)H-Wall Builder II(思维)
【瑞吉外卖】day04:员工分页查询、启用/禁用员工账号、编辑员工信息
51nod2884
容斥原理
风控建模二:建模方案拟定