Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 49fb4e6

Browse filesBrowse 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
Copy full SHA for 49fb4e6

File tree

Expand file treeCollapse file tree

1 file changed

+18
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-0
lines changed

‎doc/src/sgml/func.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/func.sgml
+18Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.