public static int addMonths(int date, int m) {
    int y0 = (int) extractFromDate(TimeUnitRange.YEAR, date);
    int m0 = (int) extractFromDate(TimeUnitRange.MONTH, date);
    int d0 = (int) extractFromDate(TimeUnitRange.DAY, date);
    m0 += m;
    int deltaYear = (int) DateTimeUtils.floorDiv(m0, 12);
    y0 += deltaYear;
    m0 = (int) DateTimeUtils.floorMod(m0, 12);
    if (m0 == 0) {
      y0 -= 1;
      m0 += 12;
    }

    int last = lastDay(y0, m0);
    if (d0 > last) {
      d0 = last;
    }
    return ymdToUnixDate(y0, m0, d0);
  }
Adds a given number of months to a date, represented as the number of days since the epoch.
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/util/DateTimeUtils.java