Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitdfe2e3f

Browse files
committed
Clarify age() 'months' calculation documentation.
1 parentf307fe4 commitdfe2e3f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.392 2007/08/31 21:33:48 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.393 2007/09/14 00:52:45 momjian Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -5906,14 +5906,13 @@ SELECT (DATE '2001-02-16', INTERVAL '100 days') OVERLAPS
59065906
</para>
59075907

59085908
<para>
5909-
Note that when the <function>age</> function operates on multi-month
5910-
intervals, <productname>PostgreSQL</> adds days to the earlier date
5911-
until full months can be added. This yields a different result than
5912-
adding full months first if the interval crosses from one month to the
5913-
next. For example, <literal>age('2004-06-01', '2004-04-30')</> yeilds
5914-
<literal>1 mon 1 day</> using the <productname>PostgreSQL</> method,
5915-
while adding the month first would yield <literal>1 mon 2 days</>
5916-
because May has 31 days, while April has only 30.
5909+
Note there can be ambiguity in the <literal>months</> returned by
5910+
<function>age</> because different months have a different number of
5911+
days. <productname>PostgreSQL</>'s approach uses the month from the
5912+
earlier of the two dates when calculating partial months. For example,
5913+
<literal>age('2004-06-01', '2004-04-30')</> uses April to yield
5914+
<literal>1 mon 1 day</>, while using May would yield <literal>1 mon 2
5915+
days</> because May has 31 days, while April has only 30.
59175916
</para>
59185917

59195918
<sect2 id="functions-datetime-extract">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp