Skip to content

Commit 49fb4e6

Browse files
committed
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
1 parent 41badea commit 49fb4e6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/src/sgml/func.sgml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9941,6 +9941,20 @@ SELECT date_trunc('hour', INTERVAL '3 days 02:47:33');
99419941
aligned with a specified origin.
99429942
</para>
99439943

9944+
<para>
9945+
<synopsis>
9946+
date_trunc(<replaceable>stride</replaceable>, <replaceable>source</replaceable>, <replaceable>origin</replaceable>)
9947+
</synopsis>
9948+
<replaceable>source</replaceable> is a value expression of type
9949+
<type>timestamp</type> or <type>timestamp with time zone</type>. (Values
9950+
of type <type>date</type> are cast automatically to
9951+
<type>timestamp</type>.) <replaceable>stride</replaceable> is a value
9952+
expression of type <type> interval</type>. The return value is likewise
9953+
of type <type>timestamp</type> or <type>timestamp with time zone</type>,
9954+
and it marks the beginning of the bin into which the
9955+
<replaceable>source</replaceable> is placed.
9956+
</para>
9957+
99449958
<para>
99459959
Examples:
99469960
<screen>
@@ -9958,6 +9972,10 @@ SELECT date_bin('15 minutes', TIMESTAMP '2020-02-11 15:44:17', TIMESTAMP '2001-0
99589972
that <function>date_bin</function> can truncate to an arbitrary interval.
99599973
</para>
99609974

9975+
<para>
9976+
Negative intervals are allowed and are treated the same as positive intervals.
9977+
</para>
9978+
99619979
<para>
99629980
The <parameter>stride</parameter> interval cannot contain units of month
99639981
or larger.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy