java 获取当前季度
程序员文章站
2022-05-15 10:57:55
...
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
String yearMonth = simpleDateFormat.format(date);
String year = yearMonth.substring(0, 4);
String month = yearMonth.substring(5, 7);
int intMonth = Integer.parseInt(month);
int quarter = intMonth % 3 == 0 ? intMonth/3 : intMonth/3+1;