[php-src] Issue #10515: DateTime Daylight Saving Time (DST) format wrong output
| From: | Traine9 | Date: | Mon, 06 Feb 2023 08:30:11 +0000 |
| Subject: | [php-src] Issue #10515: DateTime Daylight Saving Time (DST) format wrong output | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243652@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10515
Author: Traine9
### Description
The following code:
```php
<?php
print \DateTime::createFromFormat('!Y-m-d H:i:s', '2022-10-30 02:15:00', new
\DateTimeZone('Europe/Berlin'))->format('I');
```
Resulted in this output:
```
0
```
But I expected this output instead:
```
1
```
DST date for 2022 is 2020-10-30 but it returns 0 on any time in this day however on 2020-10-27 it
returns 1
Suggestion cache day and time(make attribute for easy access?) for dst for every year once it
called, i saved 15s runtime on 100k runs of format('I') in my project by implement in
class attribute cache for every year (once it called)
### PHP Version
PHP 8.2, PHP 7.1
### Operating System
_No response_