Menu

#1746 TRUNC has different results in DST and standard time

version 2.5.x
open-postponed
None
5
2026-03-11
2026-03-11
No

How to reproduce

SELECT

    TRUNC ( TIMESTAMP ( '2026-03-30', '20:30:40' ) AT TIME ZONE 'Europe/Paris' , 'YYYY' ) AT TIME ZONE 'UTC' AS TruncDST,
    TRUNC ( TIMESTAMP ( '2026-03-10', '20:30:40' ) AT TIME ZONE 'Europe/Paris' , 'YYYY' ) AT TIME ZONE 'UTC' AS TruncStandardTime

FROM "PUBLIC"."t"

Expected

All dates within the time period are truncated to the same date. In Case of YYYY, they should be truncated to the beginning of the year (standard time) of that time zone

Actual

If a date is in the daylight saving time period, it is truncated to the dst offset even if the truncated value is in standard time.
That affects other periods as well, such as MONTH, IW, DD.

This discrepancy is especially noticeable when TRUNC is used in GROUP BY. In that case, there are 2 groups per year, one for DST dates and one for dates in standard time

Discussion

  • Fred Toussi

    Fred Toussi - 2026-03-11
    • status: open --> open-postponed
    • assigned_to: Fred Toussi
     
  • Fred Toussi

    Fred Toussi - 2026-03-11

    Not a bug. Looks like the same feature as #1747.

     

Log in to post a comment.

MongoDB Logo MongoDB