public function toDateTime(DateTime $date = null): DateTime
    {
        if (!$date) {
            $date = new DateTime('1970-01-01 00:00:00');
        }
        elseif (!($date instanceof DateTimeImmutable)) {
            $date = clone $date;
        }

        return $date->setTime($this->hours, $this->minutes);
    }
public function toDateTime(DateTime $date = null): DateTime
    {
        if (!$date) {
            $date = new DateTime('1970-01-01 00:00:00');
        }
        elseif (!($date instanceof DateTimeImmutable)) {
            $date = clone $date;
        }

        return $date->setTime($this->hours, $this->minutes);
    }
public function toDateTime ( DateTime $ date = null ) : DateTime { if ( ! $ date ) { $ date = new DateTime ( '1970-01-01 00:00:00' ) ; } elseif ( ! ( $ date instanceof DateTimeImmutable ) ) { $ date = clone $ date ; } return $ date -> setTime ( $ this -> hours , $ this -> minutes ) ; }
Convert to DateTime object.

@param \DateTime|null $date
@return \DateTime
Convert to DateTime object .