Find difference between timestamps in seconds in PostgreSQL

Find difference between timestamps in seconds in PostgreSQL

Asked on January 8, 2019 in PostgreSQL.
Add Comment


  • 2 Answer(s)

    Try this Query

    SELECT EXTRACT(EPOCH FROM (timestamp_B - timestamp_A))
    
    FROM TableA
    
    

    Refer this page 

    Answered on January 8, 2019.
    Add Comment

    Below the example querys

    select age(timestamp_A, timestamp_B)
    

    use this also

    select age('2013-02-28 11:01:28'::timestamp, '2011-12-31 11:00'::timestamp);
                  age
    -------------------------------
    1 year 1 mon 28 days 00:01:28
    
    Answered on January 8, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.