psql : Convert the time to seconds

Posted by pavun_cool on Stack Overflow See other posts from Stack Overflow or by pavun_cool
Published on 2010-05-12T06:48:39Z Indexed on 2010/05/12 6:54 UTC
Read the original article Hit count: 393

Filed under:

Hi all.

I have time value 04:30:25 , I want to convert this to seconds . Is there any dedicated function to do this...?

I know that we can extract hours ,minutes, seconds then we can calculate the second .

SELECT  extract ( hour  from  t ) * 60*60 + extract (  minutes from t ) * 60 + extract  ( seconds from t )  from  test ; 

But I want some other way...

Thanks

© Stack Overflow or respective owner

Related posts about psql