src/LocalDateTime.php
public function withHour(int $hour) : LocalDateTime
    {
        $time = $this->time->withHour($hour);

        if ($time === $this->time) {
            return $this;
        }

        return new LocalDateTime($this->date, $time);
    }
public function withHour(int $hour) : LocalDateTime
    {
        $time = $this->time->withHour($hour);

        if ($time === $this->time) {
            return $this;
        }

        return new LocalDateTime($this->date, $time);
    }
public function withHour ( int $ hour ) : LocalDateTime { $ time = $ this -> time -> withHour ( $ hour ) ; if ( $ time === $ this -> time ) { return $ this ; } return new LocalDateTime ( $ this -> date , $ time ) ; }
Returns a copy of this LocalDateTime with the hour-of-day altered.

@param int $hour

@return LocalDateTime

@throws DateTimeException If the hour is invalid.
Returns a copy of this LocalDateTime with the hour - of - day altered .