public function modify($relative)
    {
        if (preg_match('/hour|minute|second/', $relative)) {
            return $this;
        }
        $new = parent::modify($relative);
        if ($new->format('H:i:s') !== '00:00:00') {
            return $new->setTime(0, 0, 0);
        }

        return $new;
    }
public function modify($relative)
    {
        if (preg_match('/hour|minute|second/', $relative)) {
            return $this;
        }
        $new = parent::modify($relative);
        if ($new->format('H:i:s') !== '00:00:00') {
            return $new->setTime(0, 0, 0);
        }

        return $new;
    }
public function modify ( $ relative ) { if ( preg_match ( '/hour|minute|second/' , $ relative ) ) { return $ this ; } $ new = parent :: modify ( $ relative ) ; if ( $ new -> format ( 'H:i:s' ) !== '00:00:00' ) { return $ new -> setTime ( 0 , 0 , 0 ) ; } return $ new ; }
Overloaded to ignore time changes.

Changing any aspect of the time will be ignored, and the resulting object
will have its time frozen to 00:00:00.

@param string $relative The relative change to make.
@return static A new date with the applied date changes.
Overloaded to ignore time changes .