OffsetDateTime.withOffsetSameInstant

Returns a copy of this {@code OffsetDateTime} with the specified offset ensuring that the result is at the same instant. !(p) This method returns an object with the specified {@code ZoneOffset} and a {@code LocalDateTime} adjusted by the difference between the two offsets. This will result _in the old and new objects representing the same instant. This is useful for finding the local time _in a different offset. For example, if this time represents {@code 2007-12-03T10:30+02:00} and the offset specified is {@code +03:00}, then this method will return {@code 2007-12-03T11:30+03:00}. !(p) To change the offset without adjusting the local time use {@link #withOffsetSameLocal}. !(p) This instance is immutable and unaffected by this method call.

@param offset the zone offset to change to, not null @return an {@code OffsetDateTime} based on this date-time with the requested offset, not null @throws DateTimeException if the result exceeds the supported date range

class OffsetDateTime
withOffsetSameInstant

Meta