If the addition is zero or the field is null, then this
is returned.
These three lines are equivalent:
DateTime added = dt.withFieldAdded(DurationFieldType.years(), 6); DateTime added = dt.plusYears(6); DateTime added = dt.plus(Period.years(6));@param fieldType the field type to add to, not null @param amount the amount to add @return a copy of this datetime with the field updated @throws IllegalArgumentException if the value is null or invalid @throws ArithmeticException if the new datetime exceeds the capacity of a long
If the addition is zero, then this
is returned. The addition will overflow into larger fields (eg. minute to hour). However, it will not wrap around if the top maximum is reached.
@param fieldType the field type to add to, not null
@param amount the amount to add
@return a copy of this instance with the field updated
@throws IllegalArgumentException if the value is null or invalid
@throws ArithmeticException if the new datetime exceeds the capacity
If the addition is zero, then this
is returned.
These three lines are equivalent:
YearMonthDay added = ymd.withFieldAdded(DurationFieldType.days(), 6); YearMonthDay added = ymd.plusDays(6); YearMonthDay added = ymd.dayOfMonth().addToCopy(6);@param fieldType the field type to add to, not null @param amount the amount to add @return a copy of this instance with the field updated @throws IllegalArgumentException if the value is null or invalid @throws ArithmeticException if the new datetime exceeds the capacity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|