My PHP Installation (7.4.22) returns the correct time for other timezones, but does not return the correct time for PDT. My Server (Ubuntu 18.04.2) Shows the correct time in UTC when logging in.
Example Script:-
<?php
$date_str_8601 = '2021-10-03T12:30:00Z'; // Input 12:30 UTC
$dateTime = DateTime::createFromFormat(DateTime::ISO8601, $date_str_8601);
date_timezone_set($dateTime, timezone_open('PDT'));
echo 'PDT ' . date_format($dateTime, 'g:i A'); // Expected: PDT 5:30 AM
date_timezone_set($dateTime, timezone_open('Europe/London'));
echo ', London ' . date_format($dateTime, 'g:i A'); // Expected: London 1:30 PM
Expected Output:
PDT 5:30 AM, London 1:30 PM
Actual Output
PDT 4:30 AM, London 1:30 PM
Why is my code giving me the wrong time for PDT? Is there something about my configuration I can fix?