How to change Postgres timezone

30 Views Asked by At

I tried to load my data for column hour = 16 ( current time 16:32 ) but i got data for hour = 15. Why is PostGreSQL late ?

SELECT d.* 
FROM data_analyse d
JOIN competences_territoriales ct ON d.ogc_fid = ct.ogc_fid
WHERE ST_Within(
    ST_Centroid(ST_SetSRID(ct.wkb_geometry::geometry, 4326)), 
    (SELECT wkb_geometry FROM departements WHERE code = '33')
) AND EXTRACT(HOUR FROM NOW() AT TIME ZONE 'UTC') = hour;

i tried also this command AND EXTRACT(HOUR FROM NOW()) = hour; no changes.

I tried to see my current sql timezone with SELECT @@GLOBAL.time_zone AS global_time_zone, @@SESSION.time_zone AS session_time_zone; but i get error missing FROM-clause entry for table "global" i know this error but dont know how to fix it here.

I use Postgre SQL 15.5

0

There are 0 best solutions below