/** * Returns a copy of this {@code LocalDateTime} with the second-of-minute altered. * <p> * This instance is immutable and unaffected by this method call. * * @param int $second the second-of-minute to set in the result, from 0 to 59 * @return LocalDateTime a {@code LocalDateTime} based on this date-time with the requested second, not null * @throws DateTimeException if the second value is invalid */ public function withSecond($second) { $newTime = $this->time->withSecond($second); return $this->_with($this->date, $newTime); }
/** * Returns a copy of this {@code OffsetTime} with the second-of-minute 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 $second the second-of-minute to set in the result, from 0 to 59 * @return OffsetTime an {@code OffsetTime} based on this time with the requested second, not null * @throws DateTimeException if the second value is invalid */ public function withSecond($second) { return $this->_with($this->time->withSecond($second), $this->offset); }