当前位置:网站首页>Use js to obtain the last quarter based on the current quarter
Use js to obtain the last quarter based on the current quarter
2022-06-26 00:11:00 【Daily log of the great demon king】
var today= myDate.toLocaleDateString();// Get current date
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));
Be careful : When the date is 01-01---03-31 Yes, in the first quarter , We need to put the year -1 That is, the fourth quarter of the previous year
incidentally : I wrote a get current date .
( You can refer to the judgment based on the current date to obtain the last quarter )
Here I write such a method , Another way is for the great God to discuss and share
边栏推荐
- Read CSV file data in tensorflow
- 详细讲解局部变量、全局变量、静态变量三种类型
- My blog is 2 years old and 167 days old today. I received the pioneer blogger Badge_ Old bear passing by_ Sina blog
- Topic36——53. Maximum subarray and
- The problem of low video memory in yolov5 accelerated multi GPU training
- Redis jump table
- 14.1.1、Promethues监控,四种数据类型metrics,Pushgateway
- Idea common shortcut keys
- EBS R12.2.0升级到R12.2.6
- How to configure SQL Server 2008 Manager_ Old bear passing by_ Sina blog
猜你喜欢

Literature research (I): hourly energy consumption prediction of office buildings based on integrated learning and energy consumption pattern classification
![[advanced ROS] Lecture 1 Introduction to common APIs](/img/25/85e8c55605f5cc999a8e85f0a05f93.jpg)
[advanced ROS] Lecture 1 Introduction to common APIs

About Simple Data Visualization

POSTMAN测试出现SSL无响应

【ROS进阶篇】第一讲 常用API介绍

文献调研(三):数据驱动的建筑能耗预测模型综述

6. common instructions (upper) v-cloak, v-once, v-pre

Studio5k V28 installation and cracking_ Old bear passing by_ Sina blog

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

Common problems encountered when creating and publishing packages using NPM
随机推荐
postman如何测试需要登录的接口
SMT葡萄球现象解决办法
记录一些cf的题
Multi-Instance Redo Apply
详细讲解局部变量、全局变量、静态变量三种类型
Redis之跳跃表
redis之详解
Thrift入门学习
网络连接验证
DateTimeFormatter与LocalDateTime
《网络是怎么样连接的》读书笔记 - 集线器、路由器和路由器(三)
redis之集群
Prototype chain test questions in JS --foo and getname
Rocket之消息存储
MySQL master-slave replication
解决线程并发安全问题
10.2.3、Kylin_ The dimension is required for kylin
farsync 简易测试
EBS R12.2.0升级到R12.2.6
Transformation of communication protocol between Siemens S7-200PLC and Danfoss inverter_ Old bear passing by_ Sina blog