Thread: Is there a way to get just the number of seconds between two timestamps?

I want to just get the number of seconds and not have to use extract
for seconds, minutes, hours, days, months, years, etc.
Is that possible?

Re: Is there a way to get just the number of seconds between two timestamps?

From
Steve Crawford
Date:
A B wrote:
> I want to just get the number of seconds and not have to use extract
> for seconds, minutes, hours, days, months, years, etc.
> Is that possible?
>
>
extract(epoch from your_end_time) - extract(epoch from your_start_time)

Cheers,
Steve


Re: Is there a way to get just the number of seconds between two timestamps?

From
Michael Lush
Date:

On Wed, 8 Apr 2009, A B wrote:
> I want to just get the number of seconds and not have to use extract
> for seconds, minutes, hours, days, months, years, etc.
> Is that possible?

I suppose you could write your own procedure and get a nice new round
thing (if your lucky,  you could reinvent the square wheel:-)

What is wrong with EXTRACT?

--
Michael
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michael John Lush PhD            Tel:44-1223 492626
Bioinformatician
HUGO Gene Nomenclature Committee    Email: hgnc@genenames.org
European Bioinformatics Institute
Hinxton, Cambridge
URL: http://www.genenames.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


> What is wrong with EXTRACT?

Nothing, now that I found out about the "epoch" option. I must haev missed that.
I just feared  to have to do extracct for each time unit...
Problem solved with extract epoch. :-)