当前位置:网站首页>JS函数获取本月的第一天和最后一天
JS函数获取本月的第一天和最后一天
2022-08-03 07:20:00 【南黎1】
本月第一天:
function getLastDay(){
var y = new Date().getFullYear(); //获取年份
var m = new Date().getMonth() + 1; //获取月份
var d = '01'
m = m < 10 ? '0' + m : m; //月份补 0
return [y,m,d].join("-")
}本月最后一天:
function getLastDay(){
var y = new Date().getFullYear(); //获取年份
var m = new Date().getMonth() + 1; //获取月份
var d = new Date(y, m, 0).getDate(); //获取当月最后一日
m = m < 10 ? '0' + m : m; //月份补 0
d = d < 10 ? '0' + d : d; //日数补 0
return [y,m,d].join("-")
}注:源码来自于网络
边栏推荐
- pyspark---low frequency feature processing
- information_schema
- CDGA|如何加强数字政府建设?
- Haisi project summary
- 【多线程进阶】--- 常见锁策略,CAS,synchronized底层工作原理,JUC,线程安全的集合类,死锁
- VR全景市场拓展技巧之“拓客宝典”
- The ORB - SLAM2 extracting feature points
- Postman will return to results generated CSV file to the local interface
- 解决移动端有纵向滚动条但是不能滚动的问题
- 华为设备配置BFD状态与接口状态联动
猜你喜欢
随机推荐
mysql备份时的快照原理
升级
boot-SSE
Data warehouse buried point system and attribution practice
模型训练前后显卡占用对比、多卡训练GPU占用分析【一文读懂】
Roson的Qt之旅#103 QML之标签导航控件TabBar
VR全景市场拓展技巧之“拓客宝典”
多线程可见
Daily practice of PMP | Do not get lost in the exam-8.2 (including agility + multiple choice)
@Async注解的坑,小心
Oracle Rac 集群文件目录迁移
keepalived安装部署
安全狗云原生安全能力全面亮相全球数字经济大会暨ISC互联网安全大会
The ORB - SLAM2 extracting feature points
10 分钟彻底理解 Redis 的持久化和主从复制
STL迭代器
postman将接口返回结果生成csv文件到本地
【多线程进阶】--- 常见锁策略,CAS,synchronized底层工作原理,JUC,线程安全的集合类,死锁
薛定谔的对象属性判断
现货黄金分析的主要流派








