php-src icon indicating copy to clipboard operation
php-src copied to clipboard

America/Los_Angeles should match PDT on 2022-03-15

Open kylekatarnls opened this issue 4 years ago • 1 comments

Description

👋 The following code:

<?php

echo DateTime::createFromFormat('Y-m-d H:i', '2022-03-15 10:00', new DateTimeZone('America/Los_Angeles'))
  ->setTimezone(new DateTimeZone('UTC'))
  ->format('Y-m-d H:i:s T');
echo "\n";
echo DateTime::createFromFormat('Y-m-d H:i', '2022-03-15 10:00', new DateTimeZone('PDT'))
  ->setTimezone(new DateTimeZone('UTC'))
  ->format('Y-m-d H:i:s T');

On 2022-03-15 those both timezones should match and it was the case until PHP 5.5.9, but since 5.5.10 it's no longer.

Resulted in this output for 5.5.10 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.28, 8.0.0 - 8.0.17, 8.1.0 - 8.1.4:

2022-03-15 17:00:00 UTC
2022-03-15 18:00:00 UTC

Resulted in this output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.9:

2022-03-15 17:00:00 UTC
2022-03-15 17:00:00 UTC

But I expected this output instead:

2022-03-15 17:00:00 UTC
2022-03-15 17:00:00 UTC

https://3v4l.org/uu12B#v5510

Thanks 🙏

PHP Version

8.1.4

Operating System

No response

kylekatarnls avatar Mar 16 '22 10:03 kylekatarnls

"PDT" is not a supported timezone. https://www.php.net/manual/en/timezones.others.php

(I've replied to the above issue too)

damianwadley avatar Mar 16 '22 11:03 damianwadley