BST
is by definition UTC+01:00
. So it works as expected. Use Europe/London
to get results you want.
Postgresql - Timezones when date range crossses into BST
-
04-07-2023 - |
Question
I have a very simple table that contains a start_date field (timestampz
) that stores a UTC datetime
value. I need to return the dates contained in the table, adjusted for British Summer Time
(BST), but the problem i'm having is that AT TIME ZONE BST
adds 1 hour to UTC
dates irrespective of their value; If the date happened in February
(before BST started), the UTC
value is the correct value. If the date value is from March
(after BST started), then the UTC
value needs +01
added to it.
Table Data
2014-02-16 00:00:000+00
2014-04-16 00:00:000+00
SELECT start_date AT TIME ZONE 'BST' from t1
adds + 01 hour to both values
2014-02-16 00:01:000
2014-04-16 00:01:000
Is there a simple way to achieve the following?;
2014-02-16 00:00:000
2014-04-16 00:01:000
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow