Thread: time calculation

time calculation

From
qradius@qnet.com.pe
Date:
Dear sirs:

Please I need to solve this problem:

I need to sustract two values timestamp type and return the
difference in seconds, exists some funciton on postgresql for
do this?

e.g:

I have value1='2001-10-01 12:50:13' and value2='2001-09-10
12:53:10'

I need to calculate value1-value2 and return how many seconds
there are between both timestamps.

thank you

Ernesto

---------------------------------------------
Este mensaje fue enviado a trav�s de Qnet
http://www.qnet.com.pe



Re: time calculation

From
Antonio Fiol Bonnín
Date:
extract ( epoch from (value1-value2) )



qradius@qnet.com.pe wrote:

> Dear sirs:
>
> Please I need to solve this problem:
>
> I need to sustract two values timestamp type and return the
> difference in seconds, exists some funciton on postgresql for
> do this?
>
> e.g:
>
> I have value1='2001-10-01 12:50:13' and value2='2001-09-10
> 12:53:10'
>
> I need to calculate value1-value2 and return how many seconds
> there are between both timestamps.
>
> thank you
>
> Ernesto
>
> ---------------------------------------------
> Este mensaje fue enviado a través de Qnet
> http://www.qnet.com.pe
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org