public long addWrapField(long instant, int years) { if (years == 0) { return instant; } // Return newly calculated millis value int thisYear = iChronology.getYear(instant); int wrappedYear = FieldUtils.getWrappedValue( thisYear, years, iChronology.getMinYear(), iChronology.getMaxYear()); return set(instant, wrappedYear); }
/** * Add to the Month component of the specified time instant wrapping around within that component * if necessary. * * @see org.joda.time.DateTimeField#addWrapField * @param instant the time instant in millis to update. * @param months the months to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int months) { return set(instant, FieldUtils.getWrappedValue(get(instant), months, MIN, iMax)); }