aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2021-04-09 21:55:08 +0200
committerPeter Eisentraut <peter@eisentraut.org>2021-04-09 21:55:08 +0200
commit49fb4e6b249029e75ccc6b490d76f15cd53d553b (patch)
treeceb13f715380d0ad791411ed822907cbaeb46749
parent41badeaba8beee7648ebe7923a41c04f1f3cb302 (diff)
downloadpostgresql-49fb4e6b249029e75ccc6b490d76f15cd53d553b.tar.gz
postgresql-49fb4e6b249029e75ccc6b490d76f15cd53d553b.zip
doc: Additional documentation for date_bin
Reported-by: Justin Pryzby <pryzby@telsasoft.com> Author: John Naylor <john.naylor@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/CAFBsxsEEm1nuhZmfVQxvu_i3nDDEuvNJ_WMrDo9whFD_jusp-A@mail.gmail.com
-rw-r--r--doc/src/sgml/func.sgml18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 67d802b02c2..d2011634075 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -9942,6 +9942,20 @@ SELECT date_trunc('hour', INTERVAL '3 days 02:47:33');
</para>
<para>
+<synopsis>
+date_trunc(<replaceable>stride</replaceable>, <replaceable>source</replaceable>, <replaceable>origin</replaceable>)
+</synopsis>
+ <replaceable>source</replaceable> is a value expression of type
+ <type>timestamp</type> or <type>timestamp with time zone</type>. (Values
+ of type <type>date</type> are cast automatically to
+ <type>timestamp</type>.) <replaceable>stride</replaceable> is a value
+ expression of type <type> interval</type>. The return value is likewise
+ of type <type>timestamp</type> or <type>timestamp with time zone</type>,
+ and it marks the beginning of the bin into which the
+ <replaceable>source</replaceable> is placed.
+ </para>
+
+ <para>
Examples:
<screen>
SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-01-01');
@@ -9959,6 +9973,10 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
</para>
<para>
+ Negative intervals are allowed and are treated the same as positive intervals.
+ </para>
+
+ <para>
The <parameter>stride</parameter> interval cannot contain units of month
or larger.
</para>