Problem with now() in PostgreSQL drivers and switch to British Summer Time
Description
The following code:
<?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
PHP is not the one picking the timezone. Check your client-side (libpq, and potentially your own code) and server-side settings to see what timezones are being defined for your connections and where.
No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.