Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit df7128b

Browse files
committed
Document that age() adds days, then full months.
1 parent 27d0749 commit df7128b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

doc/src/sgml/func.sgml

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.382 2007/06/06 23:00:35 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.383 2007/07/18 03:12:42 momjian Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -5895,6 +5895,17 @@ SELECT (DATE '2001-02-16', INTERVAL '100 days') OVERLAPS
58955895
<literal>CST7CDT</literal>.
58965896
</para>
58975897

5898+
<para>
5899+
Note that when the <function>age</> function operates on multi-month
5900+
intervals, <productname>PostgreSQL</> adds days to the earlier date
5901+
until full months can be added. This yields a different result than
5902+
adding full months first if the interval crosses from one month to the
5903+
next. For example, <literal>age('2004-06-01', '2004-04-30')</> yeilds
5904+
<literal>1 mon 1 day</> using the <productname>PostgreSQL</> method,
5905+
while adding the month first would yield <literal>1 mon 2 days</>
5906+
because May has 31 days, while April has only 30.
5907+
</para>
5908+
58985909
<sect2 id="functions-datetime-extract">
58995910
<title><function>EXTRACT</function>, <function>date_part</function></title>
59005911

0 commit comments

Comments
 (0)