> Thomas Lockhart writes:
> 
> > Why do you have a problem with the age() function? It *does* behave
> > differently than date subtraction, as explicitly mentioned in the docs
> > (preserving years, etc etc).
> 
> As you see in one of the examples I posted, it does not preserve years and
> months.  What exactly does that mean anyway?  Simple subtraction also
> preserves years and months, as I see it.

>From your URL email, this one seems to work:

        select age(date '1999-05-17', date '1957-06-13');
                      age
        -------------------------------
         41 years 11 mons 3 days 23:00
        (1 row)

This one did not:
        
        peter=# select date '1999-08-13' - date '1999-06-13';
         ?column?
        ----------
               61
        (1 row)

and this one is less than one month:
        
        peter=# select age(date '1999-05-17', date '1999-06-13');
           age
        ----------
         -27 days
        (1 row)

I will admit age() is a little confusing, but it seems to work as
intended.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to