Link to home
Start Free TrialLog in
Avatar of ekartha
ekartha

asked on

PostGreSQL Get difference between two Timestamp in minutes

Hi sir,
I would be thankful to you if you could provide me the SQL query (PostgreSQL specific) to get differnce between two Timestamp in minutes. Its urgent.
Avatar of ldbkutty
ldbkutty
Flag of India image

ASKER CERTIFIED SOLUTION
Avatar of ldbkutty
ldbkutty
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of earth man2
he's right you may want to cast it as int if you want to round down minutes.

demo=> select extract ( epoch from (interval '349 second'))/60;
     ?column?
------------------
 5.81666666666667
(1 row)

demo=> select extract ( epoch from (interval '349 second'))::int/60;
 ?column?
----------
        5
(1 row)