Browse Source

解决季度时间换算问题

feature-1.1
wuxicheng 3 years ago
parent
commit
a7973cd9b4
  1. 2
      bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/utils/DateUtils.java

2
bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/utils/DateUtils.java

@ -287,7 +287,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
case QUARTER: case QUARTER:
//季 //季
int monthValue = localDateTime.getMonthValue(); int monthValue = localDateTime.getMonthValue();
int nextQuarterMonth = (monthValue - 1) / 3 * 3 + ((int) num * 4); int nextQuarterMonth = (int)(((monthValue - 1) / 3.0) * 3) + ((int) num * 4);
LocalDateTime nextQuarterToday = localDateTime.withMonth(nextQuarterMonth); LocalDateTime nextQuarterToday = localDateTime.withMonth(nextQuarterMonth);
format = nextQuarterToday.format(formatter); format = nextQuarterToday.format(formatter);
break; break;

Loading…
Cancel
Save