Skip to content

Wrong time at DST change #3

@hans-helmut

Description

@hans-helmut

Hello Oli,

thanks for providing the code.

I would expect an offset of one hour during the DST change at Sunday, 2025-03-30 in Berlin, referring to your example:

=> SELECT event, time AT TIME ZONE 'Europe/Berlin' FROM get_sun_times(TIMESTAMP '2025-03-29', 52.5206828, 13.409282, 239) WHERE event = 'sunset';
 event  |          timezone          
--------+----------------------------
 sunset | 2025-03-28 17:37:25.239133
(1 row)

=> SELECT event, time AT TIME ZONE 'Europe/Berlin' FROM get_sun_times(TIMESTAMP '2025-03-30', 52.5206828, 13.409282, 239) WHERE event = 'sunset';
 event  |          timezone          
--------+----------------------------
 sunset | 2025-03-29 17:39:09.857757
(1 row)

=> SELECT event, time AT TIME ZONE 'Europe/Berlin' FROM get_sun_times(TIMESTAMP '2025-03-31', 52.5206828, 13.409282, 239) WHERE event = 'sunset';
 event  |          timezone          
--------+----------------------------
 sunset | 2025-03-30 17:40:54.475374
(1 row)

=> SELECT event, time AT TIME ZONE 'Europe/Berlin' FROM get_sun_times(TIMESTAMP '2025-04-01', 52.5206828, 13.409282, 239) WHERE event = 'sunset';
 event  |          timezone          
--------+----------------------------
 sunset | 2025-03-31 17:42:39.103856
(1 row)

Without conversation only the timezone changes, but not the value:

=> SELECT time,event from get_sun_times(TIMESTAMP '2025-03-30', 52.5206828, 13.409282, 239) WHERE event = 'sunset';
             time              | event  
-------------------------------+--------
 2025-03-29 17:39:09.857757+01 | sunset
(1 row)

=> SELECT time,event from get_sun_times(TIMESTAMP '2025-03-31', 52.5206828, 13.409282, 239) WHERE event = 'sunset';
             time              | event  
-------------------------------+--------
 2025-03-30 17:40:54.475374+02 | sunset
(1 row)

Due to my understanding the time-value is in local-time of timezone-offset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions