diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 78812b2dbe..6bf81cac3a 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -10321,6 +10321,31 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0 The stride interval must be greater than zero and cannot contain units of month or larger. + + + When the source and origin + are separated by a daylight savings time boundary, the change will be reflected in + the result, as in the second query: + + +SET TIMEZONE TO 'America/New_York'; +SELECT date_bin('1 day', '2021-11-01 00:00 +00'::timestamptz, '2021-09-01 00:00 -04'::timestamptz); +Result: 2021-10-31 00:00:00-04 + +SELECT date_bin('1 day', '2021-11-10 00:00 +00'::timestamptz, '2021-09-01 00:00 -04'::timestamptz); +Result: 2021-11-08 23:00:00-05 + + + It is possible to force the result to align to local midnight by casting the + source and origin to + timestamp: + + +SET TIMEZONE TO 'America/New_York'; +SELECT date_bin('1 day', '2021-11-10 00:00 +00'::timestamptz::timestamp, '2021-09-01 00:00 -04'::timestamptz::timestamp); +Result: 2021-11-09 00:00:00 + +