function getQuarterByMonth(){
var today = new Date(); //获取当前时间
var month = today.getMonth() + 1;//getMonth返回0-11
//下面是几个if
if(month >=1 && month <=3){
return 1;
}else if(month >=4 && month <=6){
return 2;
}else if(month >=7 && month <=9){
return 3;
}else{
return 4;
}
}
How to get the current quarter, according to the current month with javascript
Guess you like
Origin blog.csdn.net/ShangMY97/article/details/103893214
Recommended
Ranking