当前位置:网站首页>用js根据当前季度获取上一季度
用js根据当前季度获取上一季度
2022-06-25 22:13:00 【大魔王的日常Log】
var today= myDate.toLocaleDateString();//获取当前日期
var strYear = myDate.getFullYear();
var strMonth = myDate.getMonth() + 1;
var strQuarter = Math.floor((strMonth % 3 == 0 ? (strMonth / 3) : (strMonth / 3 + 1)));
strYear=((strQuarter==1)?(strYear-1):(strYear));
strQuarter=((strQuarter==1)?(4):(strQuarter-1));
注意:当日期为01-01---03-31是也就是第一季度的时候,我们需要把年-1也就是上一年的第四季度
顺便:我写了个获取当前日期。
(可以参考一下根据当前日期进行判断获取上一季度)
这里我就写这么一种方法,另一种方法大神可以讨论分享一下
边栏推荐
- Common methods of object class
- Bit compressor [Blue Bridge Cup training]
- PCB生产为什么要做拼板和板边
- 2021-04-28
- Network connection verification
- 寻找翻转数组的最小值[抽象二分]
- Servlet response下载文件
- Literature research (I): hourly energy consumption prediction of office buildings based on integrated learning and energy consumption pattern classification
- Connecting MySQL database with VBScript_ Old bear passing by_ Sina blog
- 10.4.1 données intermédiaires
猜你喜欢

(转载)进程和线程的形象解释

10.2.3、Kylin_ The dimension is required for kylin

Thrift入门学习

迅为RK3568开发板使用RKNN-Toolkit-lite2运行测试程序

Lazy people teach you to use kiwi fruit to lose 16 kg in a month_ Old bear passing by_ Sina blog

WINCC与STEP7的仿真连接_过路老熊_新浪博客

Final and static
![Bit Compressor [蓝桥杯题目训练]](/img/d5/231d20bf4104cc2619b2a4f19b605c.png)
Bit Compressor [蓝桥杯题目训练]

手工制作 pl-2303hx 的USB转TTL电平串口的电路_过路老熊_新浪博客

86.(cesium篇)cesium叠加面接收阴影效果(gltf模型)
随机推荐
11.1.2、flink概述_Wordcount案例
Virtual and pure virtual destructors and their implementation in c++
redis之详解
huibian
How to configure SQL Server 2008 Manager_ Old bear passing by_ Sina blog
10.4.1、数据中台
POSTMAN测试出现SSL无响应
Let's talk about string today
10.2.3、Kylin_ The dimension is required for kylin
Circuit de fabrication manuelle d'un port série de niveau USB à TTL pour PL - 2303hx Old bear passing Sina blog
关于运行scrapy项目时提示 ModuleNotFoundError: No module named 'pymongo‘的解决方案
安装PSU的时候/usr/bin/ld:warning: -z lazyload ignore
如何绕过SSL验证
贴片机供料器(feeder)飞达的种类,如何工作
Stop eating vitamin C tablets. These six fruits have the highest vitamin C content
DateTimeFormatter与LocalDateTime
Shredding Company poj 1416
解决线程并发安全问题
文獻調研(三):數據驅動的建築能耗預測模型綜述
Unable to start debugging. Unexpected GDB output from command “-environment -cd xxx“ No such file or