I tested both the solutions JohnConde and denoise.
with this script:
$format = 'Y-m-d H:i:s';
$datetime_str = '2022-10-28 17:24:00';
$timezone_str = 'Europe/Rome';
$dt_test_denoise = DateTime::createFromFormat($format, $datetime_str,
new DateTimeZone($timezone_str));
echo '$dt_test_denoise:';
echo "<br/>";
var_dump($dt_test_denoise);
echo "<br/>";
echo "<br/>";
$dt_test_JohnConde = DateTime::createFromFormat($format, $datetime_str);
$dt_test_JohnConde->setTimeZone(new DateTimeZone($timezone_str));
echo '$dt_test_JohnConde:';
echo "<br/>";
var_dump($dt_test_JohnConde);
echo "<br/>";
echo "<br/>";
execute this on http://phptester.net/ and you will see the differences.
I think the best is solution denoise!