[php-src] Issue #8258: Problem with now() in PostgreSQL drivers and switch to British Summer Time
| From: | bugs10374 | Date: | Mon, 28 Mar 2022 01:04:42 +0000 |
| Subject: | [php-src] Issue #8258: Problem with now() in PostgreSQL drivers and switch to British Summer Time | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240518@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8258
Author: bugs10374
### Description
The following code:
```php
<?php
$query = "select extract(epoch from now()) as ts";
$res = pg_query($Database, $query);
$ts = pg_result($res, 0, "ts");
echo $ts;
```
Resulted in this output:
```
An hour ahead of where it should be between midnight and 2am when the clocks go forward in spring in
the UK.
Just doing "select now()" also resulted in the same fault.
```
But I expected this output instead:
```
The correct unix epoch.
```
This is not about the PHP now() function, which correctly puts the clock forward at 2am. The
postgresql drivers appear to do this at midnight, which is two hours early.
Running the same query directly against the database returns the correct epoch and time, which is
why I am raising this here and not with Postgres directly.
Never seen anything like it! Apologies if this is a dupe - looked for it but couldn't find it.
### PHP Version
PHP FPM 7.4
### Operating System
Debian Latest Stable