Search Postgresql Archives

Re: date time function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I can't anything in the docs that explain how intervals print out. They seem to show like this:

> select now() - '1990-01-01';
           ?column?
-------------------------------
6388 days 13:06:26.3605600595

or like this:

> select now() - current_date;
    ?column?
-----------------
14:06:46.119788

unless you use age(), which supposedly also returns an interval:

> select age(now(), '1990-01-01');
                   age
-----------------------------------------
17 years 5 mons 28 days 14:08:04.524803

Why do the first and third intervals print out differently? I see this in the docs for age:

Subtract arguments, producing a "symbolic" result that uses years and months

But age() is documented as simply producing an interval - where is the magic that makes the first and third results above look different? Ah, wait a minute - does this have to do with the varying number of days in different months?

Thanks.

- John D. Burger
  MITRE




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux