time calculation

Started by Nonameover 24 years ago2 messagesgeneral
Jump to latest
#1Noname
qradius@qnet.com.pe

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

#2Antonio Fiol Bonnín
fiol@w3ping.com
In reply to: Noname (#1)
Re: time calculation

extract ( epoch from (value1-value2) )

qradius@qnet.com.pe wrote:

Show quoted text

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