/** * Returns a copy of this {@code LocalDateTime} with the nano-of-second altered. * <p> * This instance is immutable and unaffected by this method call. * * @param int $nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 * @return LocalDateTime a {@code LocalDateTime} based on this date-time with the requested nanosecond, not null * @throws DateTimeException if the nano value is invalid */ public function withNano($nanoOfSecond) { $newTime = $this->time->withNano($nanoOfSecond); return $this->_with($this->date, $newTime); }
/** * Returns a copy of this {@code OffsetTime} with the nano-of-second altered. * <p> * The offset does not affect the calculation and will be the same in the result. * <p> * This instance is immutable and unaffected by this method call. * * @param int $nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999 * @return OffsetTime an {@code OffsetTime} based on this time with the requested nanosecond, not null * @throws DateTimeException if the nanos value is invalid */ public function withNano($nanoOfSecond) { return $this->_with($this->time->withNano($nanoOfSecond), $this->offset); }