Re: Getting interval in seconds? - Mailing list pgsql-general

From Lincoln Yeoh
Subject Re: Getting interval in seconds?
Date
Msg-id 3.0.5.32.20010610114704.00fea960@192.228.128.13
Whole thread Raw
In response to Getting interval in seconds?  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Responses Re: Getting interval in seconds?
List pgsql-general
Thanks!

Which is better/faster?

select date_part('epoch',('now'::timestamp - somedate)::interval) from
sometable;

Or

select extract (epoch from interval ('now'::timestamp - somedate)) from
sometable;

Should I be using 'now'::timestamp or some function form of it?

Cheerio,
Link.

At 10:34 PM 10-06-2001 -0400, Alex Pilosov wrote:
>On Sun, 10 Jun 2001, Lincoln Yeoh wrote:
>
>> Hi,
>>
>> How do I convert an interval to the number of seconds?
>>
>> e.g. I'd like the following to produce a result in seconds.
>>
>> select ('now'::timestamp - somedate)::interval from sometable;
>
>select date_part('epoch',('now'::timestamp - somedate)::interval) from
>sometable;
>
>-alex
>
>
>


pgsql-general by date:

Previous
From: Alex Pilosov
Date:
Subject: Re: Re: inserting, index and no index - speed
Next
From: Alex Pilosov
Date:
Subject: Re: Getting interval in seconds?