I converted the time 18:00:00 pm UTC time to Los angeles time and the output of the program was 10 AM and then I searched this on google "18:00:00 pm UTC to Los angeles time" and google showed me the result 11:00 AM
https://i.imgur.com/H5po3fD.png
I am confused whats correct here. Similarly if I convert converted_date_time('2021-11-08 04:54:15') UTC to los angles time then the program output shows the time 8:54 AM but on google it shows 9:54 AM.
date_default_timezone_set("America/Los_Angeles");
echo date_default_timezone_get();
echo '<br>';
function converted_date_time($dt) {
$datetime = new DateTime($dt, new DateTimeZone('UTC'));
$datetime->format('Y-m-d H:i:s');
$datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
return $datetime->format('Y-m-d H:i:s');
}
//convert time to utc
echo converted_date_time('2021-11-08 18:00:00').'<br>';