Clarify age() 'months' calculation documentation.
authorBruce Momjian
Fri, 14 Sep 2007 00:52:45 +0000 (00:52 +0000)
committerBruce Momjian
Fri, 14 Sep 2007 00:52:45 +0000 (00:52 +0000)
doc/src/sgml/func.sgml

index d83135ba03c5e3d5a84c4007985a424720fa83b6..e61a20aa3962ad003928749f96453d30f0806b28 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
  
   Functions and Operators
@@ -5906,14 +5906,13 @@ SELECT (DATE '2001-02-16', INTERVAL '100 days') OVERLAPS
   
 
   
-   Note that when the age function operates on multi-month
-   intervals, PostgreSQL adds days to the earlier date
-   until full months can be added.  This yields a different result than
-   adding full months first if the interval crosses from one month to the
-   next.  For example, age('2004-06-01', '2004-04-30') yeilds
-   1 mon 1 day using the PostgreSQL method,
-   while adding the month first would yield 1 mon 2 days
-   because May has 31 days, while April has only 30.
+   Note there can be ambiguity in the months returned by
+   age because different months have a different number of
+   days.  PostgreSQL's approach uses the month from the
+   earlier of the two dates when calculating partial months.  For example,
+   age('2004-06-01', '2004-04-30') uses April to yield
+   1 mon 1 day, while using May would yield 1 mon 2
+   days because May has 31 days, while April has only 30.