Re: fomatting an interval (resend)

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Forest Wilkinson <lyris-pg(at)tibit(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: fomatting an interval (resend)
Date: 2003-05-15 02:02:57
Message-ID: 20030515020257.GK2353@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, May 14, 2003 at 10:12:41AM -0700, Forest Wilkinson wrote:

> >Here is one consistent conversion that will show you the number of seconds
> >without anything else:
> >
> >select round(extract(epoch from finish) - extract(epoch from start)) from timetable;
>
> Hmm. The postgres 7.3 docs give me the impression that extract() will
> return one field of a multi-field value, such as '4 days' from '2
> years 4 days 15:01'. Experimenting in psql seems to prove this. For
> example:

Extracting(epoch) from an interval is a special case. It returns the
total number of seconds in the interval. Note that it is quite
different from extracting(epoch) from a timestamp.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Si quieres ser creativo, aprende el arte de perder el tiempo"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James Gregory 2003-05-15 02:18:54 Re: server process segfaulting
Previous Message Tom Lane 2003-05-15 01:27:41 Re: How many levels a B-tree has?

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-05-15 03:00:36 Re: 7.4 features list
Previous Message markw 2003-05-14 22:51:03 OSDL DBT-2 for PostgreSQL