Month.adjustInto

Adjusts the specified temporal object to have this month-of-year. !(p) This returns a temporal object of the same observable type as the input with the month-of-year changed to be the same as this. !(p) The adjustment is equivalent to using {@link Temporal#_with(TemporalField, long)} passing {@link ChronoField#MONTH_OF_YEAR} as the field. If the specified temporal object does not use the ISO calendar system then a {@code DateTimeException} is thrown. !(p) In most cases, it is clearer to reverse the calling pattern by using {@link Temporal#_with(TemporalAdjuster)}: !(pre) // these two lines are equivalent, but the second approach is recommended temporal = thisMonth.adjustInto(temporal); temporal = temporal._with(thisMonth); </pre> !(p) For example, given a date _in May, the following are output: !(pre) dateInMay._with(JANUARY); // four months earlier dateInMay._with(APRIL); // one months earlier dateInMay._with(MAY); // same date dateInMay._with(JUNE); // one month later dateInMay._with(DECEMBER); // seven months later </pre> !(p) This instance is immutable and unaffected by this method call.

@param temporal the target object to be adjusted, not null @return the adjusted object, not null @throws DateTimeException if unable to make the adjustment @throws ArithmeticException if numeric overflow occurs

class Month
override
adjustInto

Meta