Re: fomatting an interval (resend)

From: lyris-pg(at)tibit(dot)com
To: pgsql-general(at)postgresql(dot)org
Cc: greg(at)turnstep(dot)com
Subject: Re: fomatting an interval (resend)
Date: 2003-05-29 21:26:16
Message-ID: 7jucdvsvcuefau6lnj5t9mdftu8h07v00f@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

>> Okay, so extract() doesn't fit the bill either. How do I get the
>> difference between two timestamps in terms of days, expressed as an
>> integer? Moreover, how do I get any interval expressed in those
>> terms?
>
>select round((extract(epoch from finish) - extract(epoch from start))/(60*60*24))
> from timetable;

How would that differ from the query below?

select round(extract(epoch from (finish - start))/(60*60*24)) from
timetable;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-05-29 21:41:29 Re: PLPGSQL problem with SELECT INTO
Previous Message Franco Bruno Borghesi 2003-05-29 20:56:16 Re: postgresql 7.3.3

Browse pgsql-hackers by date

  From Date Subject
Next Message Sander Steffann 2003-05-29 21:41:09 Re: No more RH7.3 RPMs?
Previous Message Bruno Wolff III 2003-05-29 19:30:52 Re: Question about simple function folding optimization